Help With Syncing Script....
Okay here is the deal....I have a source server with files and a remote server that needs a copy of the files. I am using ftp with Winscp scripts and I run a scheduled task to run the scripts.
My script copies the files over/syncs no problem, if a file is modified it works fine, however if I rename a file it will keep the old file as well as the renamed file (so two copies of the same file, just different name)
So I thought by adding the -delete to my script it would resolve obsolete files (get rid of the second file)
When I added the -delete after running the script, it goes thru scans all the files and as soon as its done it starts deleteing everything!!! not just the obsolete files.....
Here is the script:
# Automatically answer all prompts negatively not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open user:password@example.com
open ftp://<REMOVED_BY_ADMIN> -passive=off
# Not setting transfer mode since assume will default to automatic
# Perform synch
synchronize remote "d:\Company\Shared Files for offices\Scanned Contracts" /scanned-contracts -criteria=time -delete
# Disconnect
close
# Exit WinSCP
exit
My script copies the files over/syncs no problem, if a file is modified it works fine, however if I rename a file it will keep the old file as well as the renamed file (so two copies of the same file, just different name)
So I thought by adding the -delete to my script it would resolve obsolete files (get rid of the second file)
When I added the -delete after running the script, it goes thru scans all the files and as soon as its done it starts deleteing everything!!! not just the obsolete files.....
Here is the script:
# Automatically answer all prompts negatively not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open user:password@example.com
open ftp://<REMOVED_BY_ADMIN> -passive=off
# Not setting transfer mode since assume will default to automatic
# Perform synch
synchronize remote "d:\Company\Shared Files for offices\Scanned Contracts" /scanned-contracts -criteria=time -delete
# Disconnect
close
# Exit WinSCP
exit