Topic "Getting the "oldest" file"

Author Message
mw4
[View user's profile]

Joined: 2014-04-02
Posts: 1
Location: san fran
Using automation, what would the wildcard or other way to get the oldest file from a directory list like this:

FAIR_INVOC.2014_07_10_0132.TXT.PGP
FAIR_INVOC.2014_07_10_0145.TXT.PGP
FAIR_INVOC.2014_07_10_0156.TXT.PGP
FAIR_INVOC.2014_07_10_0159.TXT.PGP

Obviously date and time are listed within the filename as YYYY_MM_DD_HHMM, but logically it would be the oldest file time stamp as well.

I just want the cleanest/easiest way to get just the ONE oldest file (could be one file in the directory or 10 with FAIR_INVOC), which in this case would be FAIR_INVOC.2014_07_10_0132.TXT.PGP.

Thanks!
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25025
Location: Prague, Czechia
Just reverse a logic of:
https://winscp.net/eng/docs/script_download_most_recent_file
_________________
Martin Prikryl
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