Topic "Script to get only yesterday folder"

Author Message
Mahdi Bashiri
[View user's profile]

Joined: 2012-04-16
Posts: 20
Hi
I need script to get only yesterday folder exactly, so i use get -filemask="*>=1D" but this command get all folder before today, please let me know how can i use this command to get only yesterday folder, also how can i use that on batch script file.

Regards,
Mahdi
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
The above command will download all files created in the last 24-hours. It has no effect on directories. So it will recreate the complete remote directory structure locally, while most of the folders should be empty.

Is there a way to identify the yesterdays folder? By a name?

You may also be able to use a technique described here:
https://winscp.net/eng/docs/script_download_most_recent_file
Mahdi Bashiri
[View user's profile]

Joined: 2012-04-16
Posts: 20
Yes, The folder name has date pattern like yyyy-mm-dd, but the date pattern is in persian (Iranian) Date, for example 1394-05-03 that equals to 2015-07-24. also the folder name created by program itself on outside ftp server and we can not any access to change this pattern.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Would it help to download the last directory when sorted "by alphabet"?

Then, you can try to modify following example to sort by .Name, instead of .LastWriteTime. And of course remove the -Not $_.IsDirectory filter.
https://winscp.net/eng/docs/script_download_most_recent_file
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