Topic "Automate download/upload of only new files"

Author Message
prmayer
[View user's profile]

Joined: 2016-01-27
Posts: 5
Pretty new to the scripting features of WinSCP but I need to grab daily files from one FTP and move them to another preferable while appending a bit of text to the start. I've got the download and upload script working but I've run into an issue. The important part is I only want to have the destination folder get loaded to have the newest file. The source folder could have months worth of data I won't need but don't want to delete. Is there a way to say only download or upload the newest file or a file created in the last x hours?

Right now I'm on using:
get vendor.edi C:\ats\vendor\
and:
put C:\ats\vendor\vendor.edi /home/data/ats/vendor/vendor.edi
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
To upload only files modified in the last 5 hours, and which are not present in the remote directory yet, use:

put -neweronly -filemask=*>5H C:\ats\vendor\vendor.edi /home/data/ats/vendor/vendor.edi

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