Copying file from server based on date today

Advertisement

ebensalot
Guest

Copying file from server based on date today

I have a problem regarding copying file from the server, I want to copy a file based on date only the file generated today will be copied from the server this is my code I use for now:

option batch abort
option confirm off
open sftp://username:password@hostname -hostkey="ssh-rsa 2048 C5:86:05:bd:ce:66:ec:18:e2:10:b6:40:2f:81:a0:a6"
synchronize local C:\Users\LocalPC\Documents\copy1fromserver /media/Server/serverdb/copy1tolocal

I hope you can help me.

Thanks,
Melvin.

Reply with quote

Advertisement

ebensalot
Guest

Re: Copying file from server based on date today

martin wrote:

If you want to download today's files only, use:

get -filemask="*>=%TIMESTAMP#yyyy-mm-dd%" /media/Server/serverdb/copy1tolocal/* C:\Users\LocalPC\Documents\copy1fromserver\

See https://winscp.net/eng/docs/script_download_most_recent_file#alternatives

Hi sir, thanks for your help I have another issue can I get the file before the date to today eg:

after 1:00 am all the folder files yesterday will get from the server by folder.
Thanks,
Melvin.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: Copying file from server based on date today

If I understand your question correctly, you just need to replace the comparison. I.e. use < instead of the >=.

Reply with quote

Advertisement

You can post new topics in this forum