Hi,
I am trying to write a batch file to find the folder that has the largest number in its name.
i.e. I have 3 dummy folders with alphanumeric names in the directory
Prod110000
Prod112000
Prod114000
So it should find “Prod114000” for me. I’m trying to pull just the numbers part of the folder name so I can use GTR to compare – I am having troubles pulling the numbers part out of the batch variable (%%G) though because I can’t manipulate it.
I suspect there is also some problem in the “set latestdir=%%G” statement too.
What I (only) have right now is this:
g:
cd G:\xxxxxxxx
for /D %%G in (“Prod*”) do if %%G GTR %latestdir:~4,10% set latestdir=%%G
Thanks for the help!
Good luck.
Please come back & tell us if your problem is resolved.