Link to home
Start Free TrialLog in
Avatar of Jukka Jääheimo
Jukka Jääheimo

asked on

A batch file to select file with greatest id

I will have several files during the day. Cannot select the latest with timestamp, i need to have to file with the greatest id.

The file name is in a format: [standardname]_[date]_[id].csv. Eg invoices_2017_09_19_186.csv
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

Is the ID always 3 digits?  If so, sort by file name.  The greatest will always be the last.

If not, this would be MUCH easier with a VB Script, but still doable with batch (and probably insanely simple with PowerShell (but that I don't know).
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jukka Jääheimo
Jukka Jääheimo

ASKER

Great! That worked perfectly! Thank you!