Topic "Using sync to download new files only"

Author Message
pc99
[View user's profile]

Joined: 2015-07-26
Posts: 1
Hi all

What I'm trying to do is have winscp.com as a scheduled task regularly retrieve files (including subfolders) from remote /media/folder and place them in local c:\download. I'm using this (which seems to do the job very well):

winscp.com /command "option batch abort" "open sftp://user:pass@site" "synchronize local -criteria=size -preservetime -transfer=automatic -resumesupport=on C:\download /media/folder" "close" "exit"

The problem is that I then have another program monitoring c:\download which moves files and folders received based on certain criteria. The problem, of course, is that when winscp.com runs the next time, it sees that the files are missing, and downloads them again - when all I want are the new files it hasn't seen before. Any suggestions about how to get around this? I was thinking there might be a way for windows task scheduler or winscp to store its last run time in an environment variable or in a file or something, and then add something like -filemask=>%LASTRUNTIME% to the above command so that it only grabs files in /media/folder newer than the last run date... but I can't work out how to do that.

Any suggestions?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
As you have already realized, you have to create the synchronization script dynamically with the file mask with time constraint.

What you can do is dynamically generate the script for the next run as the end of the synchronization using the current timestamp.

See also
https://winscp.net/eng/docs/faq_script_modified_files#no_old_files
https://winscp.net/eng/docs/script_download_timestamped_filename#scripting
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