Pablo prez
Pablo prez

Reputation: 199

Downloading files with today's date only from SFTP server with WinSCP

I am trying to only download files that are created today, just like tomorrow I would only want to download files created tomorrow only. Essentially I log into the remote server with my script and download all the files right now with synchronize local. What I want to do is just only download the files created today. Right now I just added the filemask and I am still getting all of the files however I only want today's files.

open sftp://location.net -passphrase="passphrase" -hostkey="key"
synchronize local C:\Users\localdrive\Desktop\test2   /Home/remoteFolder/
exit

I also tried

get /Home/remoteFolder/ -filemask=*>1D

and it hasn't changed anything.

Any suggestions would be great.

Upvotes: 2

Views: 6133

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202272

Use a file mask with a time constraint and the today keyword to create the today's constraint.

get -filemask=">=today" /remote/path/* C:\local\path\

(You need WinSCP 5.15 or newer for the today keyword)


Your *>1D file mask downloads files created/modified in the last 24 hours, so not only today's files.

Further reading:

Upvotes: 3

Related Questions