I'm using WinSCP (Version 5.7.5, Build 5665) automation and scripting to synchronize (local to remote) some Web Sites content (Windows, IIS). It works well but recently I noticed something, that I'd like to resolve. I perform the synchronization over FTP.
Settings are following:
option batch continue
option confirm off
option transfer binary
Synchronization is realized through this command
synchronize remote -delete C:\source_folder /destination_folder
Now, if add, delete or update existing file/folder in source_folder, synchronization works like a charm. But if I replace file/folder with the same file/folder which has a timestamp that is earlier than the same file on destination_folder, this one is not being transferred to remote folder. I checked the documentation to WinSCP and found, that in order to solve this, I need to use -mirror
With Synchronize files mode, the newer files in source directory are transferred to the opposite directory. Files in source directory not present in target directory can optionally be transferred as well (disable this using the option Existing files only). Files in target directory not present in source directory are optionally deleted (enable option Delete files). In Both mode (see above), file not present in an opposite directory is considered new, hence it is transferred (if allowed), but never deleted. In other words, in Both mode, no file is ever deleted.
With Mirror files mode, the different (both newer and older) files in source directory are transferred to the opposite directory. Otherwise the mode is the same as Synchronize files.
When I tested this, I noticed that WinSCP is actually synchronizing all files and folders with -mirror
mode. I need to achieve, that only modified files/folders are being synchronized, no matter if file/folder on source_folder is newer or older than the same existing file/folder on destination_folder - this was the case when I used synchronize remote -delete
mode, but older files were not transferred.
Is there a way to achieve this without synchronizing all files? I can't allow this as some folders have gigs of data.
Thanks for help.