If you want the "synchronize" to delete files, you need to add -delete switch.
I am trying to ensure a local folder is synced up with my web server. I use it as a backup mechanism and do not mod files in the local folder, I just want to ensure that the local folder represents the contents of the web server after each sync.
Remote web server:
Windows Server 2003 R2 32bit
WinSCP v184.108.40.2063 (also tried older versions with same result)
Scripting used to sync local and remote web server
Transfer Protocol: SFTP (SCP)
option batch continue
option echo off
option confirm off
open backup:email@example.com:22 -timeout=300 -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
call rm -f /tmp/all_databases.sql
call mysqldump -h localhost --user xxxxx --password=xxxxxxxx --all-databases > /tmp/all_databases.sql
call gzip -c /tmp/all_databases.sql > /tmp/all_databases.gz
call rm /tmp/all_databases.sql
get -delete /tmp/all_databases.gz Z:\web1\all_databases.gz
synchronize local Z:\web1\www /var/www -criteria=time
I can't see any obvious cause for the script exiting prematurely. It runs through collection of sync data, then starts syncing files, then simply exits with no error to show why. The file list on the local system does not match the file list on the remote web server to the tune of 20k+ files that exist locally but do not exist on the remote web server (i.e. I deleted them on the web server and I want them gone locally too). Of course I could remove them from the local machine manually, but that's the job of the sync command and it's not performing. I've run the script multiple times and every time I get the same result. Any ideas?