Topic "Help With Syncing Script...."

Author Message
Guest




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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
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.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License