Guest blittle Posted February 19, 2004 Share Posted February 19, 2004 I need some newbie help. The scenario is, I have 2 files, one on a server and one in a temporary directory on my pc. I want to find out if the file that i have on my pc is in the server and if it is i want to delete it from the server. The catch is the file on the pc and server change periodically so i can't specify a file name in the script. I basically want to get the file name from the pc and pass it to the server and delete it if it is present. Any help would be much appreciated B. Link to comment Share on other sites More sharing options...
Josbe Posted February 20, 2004 Share Posted February 20, 2004 (edited) Would be, many ways...I sugesst one: If the file is growing in size, you would can use FileGetSize()and comparing...Or also reading the contents with "Comp" command.(DOS command) Edited February 20, 2004 by josbe AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
scriptkitty Posted February 20, 2004 Share Posted February 20, 2004 (edited) You most likely want to do a file comparision or something, but here is a quick script to just do only what you said. You can loop this if you like to do multiple files, I only used one, since you said file. ; Shows the filenames of all files in the current directory, note that "." and ".." are returned. $search = FileFindFirstFile("c:\temp\*.au3"); change to whatever temp dir you have ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf $file = FileFindNextFile($search) MsgBox(4096, "File:", $file) ; Close the search handle FileClose($search) If FileExists ("\\server\temp\"&$file) Then; change to your server location ; option 1 $x=FileCopy("c:\temp\" & $file,"\\server\temp\" & $file,1) this will just overwrite it. ; option 2 ; $x=FileDelete("\\server\temp\"&$file); uncomment this if you meant to delete. Else MsgBox(1,"Info","File not on server.") $x=2 EndIf If $x=1 Then MsgBox(1,"File deleted","") If $x=0 Then MsgBox(1,"Error","File not deleted") ...edit added options. Edited February 20, 2004 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
Guest blittle Posted February 20, 2004 Share Posted February 20, 2004 thank you kitty, you saved my life. LOVE YA Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now