Topic "Copying file from server based on date today"

Author Message
ebensalot

Guest


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.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
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
ebensalot

Guest


prikryl 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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
If I understand your question correctly, you just need to replace the comparison. I.e. use < instead of the >=.
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