Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Help With Syncing Script....

wflorence wrote:

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.....

Please attach a complete session log file showing this. Ideally on a small set of test files.
Guest

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