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

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

Haribandhu
Guest

Copy only previous dated timestamp files from client server

Hi martin,

I am using below condition to copy only previous day timestamp files to local server from client but not working.

get -filemask= "*=yesterday%TIMESTAMP#mm/dd/yyyy%"  /outbox/payment/*  E:\Informatica\9.6.1\server\infa_shared\SrcFiles\

One more thing observed = and *=1D commands are not working

Can you please check and revert on the same.

Thanks in Advance.


best Regards,
hari

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
34,115
Location:
Prague, Czechia

Re: Copy only previous dated timestamp files from client server

There's no = operator. And there cannot be a space after the -filemask=.

If you want to transfer only yesterday files, use:
get -filemask=">=yesterday<today" /outbox/payment/* E:\Informatica\9.6.1\server\infa_shared\SrcFiles\
See https://winscp.net/eng/docs/file_mask#size_time

Reply with quote

Advertisement

You can post new topics in this forum