Facing problem to get recent file

Advertisement

Prashanth
Guest

Facing problem to get recent file

Hi
I wanted to download the most recent file from the remote directory please see the below script:
get filemask="*>1d" 
get filemask="*<1d"
I used both the scripts but the result is same like it downloads all the files from remote directory.

And even my question is how to pass the specific timestamp into my script or batch file.

Please help me to sort out from this.

Thanks
Prashanth

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
38,189
Location:
Prague, Czechia

Re: Facing problem to get recent file

First you are missing a dash before filemask. It should be: get -filemask="*>1d".
Second that command does not download the most recent file, it downloads all files created/modified in the last 24 hours. What may happen to be all files in the directory.
To download the most recent file, refer to:
Downloading the most recent file

and even my question is how to pass the specific timestamp into my script or batch file.
That's quite broad question.
See
https://winscp.net/eng/docs/scripting#arguments
https://winscp.net/eng/docs/script_upload_multiple_servers

Reply with quote

Harinath
Guest

Filemask not working

Hi
I need to setup file transfer at 10secs interval and transfer only the new files added to the folder since.
My following script is transferring all files and somehow filemask is not working.
#copy  entire folder 
put -filemask="*>=10S" *
exit

Reply with quote

martin
Site Admin
martin avatar

Re: Filemask not working

@Harinath: Start a new thread and include a full script log file.

Though what you are doing is imho a bad idea. You may miss some files with such a tight schedule.

Reply with quote

BRichmond
Guest

Relative time, e.g. -filemask="*>=1D"

If I use -filemask="*>=1D", does that compare just the day component of time, or does it compare using 24 hours? Example, if source file was created 25 hours ago at 7am my time yesterday, if I do a get using *>=1D, will that file get picked up? The date is one day old, but the time is more than 24 hours ago. Thanks.

Reply with quote

Advertisement

Trupti B
Guest

Facing the problem to download the latest file

Hi
I wanted to download the most recent file from the remote directory please see the below script:
get -latest --> it downloads all the files.
get -filemask="file_name_*>=1D" --> it downloads all files created/modified in the last 24 hours.
get -latest -filemask="file_name_*>=1D" --> it downloads all files created/modified in the last 24 hours.

As files are not uploaded on daily basis that's why above scripts are not working. Suppose I have uploaded the last file on 23rd July and today is 28th July, I want to download the 23rd July file.
Is it possible to download the 23rd July file?

Reply with quote

martin
Site Admin
martin avatar

Re: Facing the problem to download the latest file

@TruptiB: I'm not sure I follow. Are you asking for WinSCP to detect, what file was the last one uploaded, even if there are other files with later timestamp?
The best would be if you post a session log file (use /log=C:\path\to\winscp.log command-line argument) and give us a name of the file you wanted to upload and describe what was uploaded instead.

Reply with quote

Advertisement

You can post new topics in this forum