Link to home
Start Free TrialLog in
Avatar of Rob Rudloff
Rob RudloffFlag for United States of America

asked on

BATCH find highest numbered .jpg and save in a variable ?

Hi.
I have a folder with many .jpg files.
I need a Windows batch program to find the highest numbered file + 1 and save it to a variable.
So, I have in my folder:
211-25.jpg
215-01.jpg
215-04.jpg
218-03.jpg
218-12.jpg

Open in new window

and i want a batch file that i will send a prefix to, like "215" then have it return an integer equal to the last in the series + 1, so it would return "5".
Any suggestions for me to try?
Thanks!
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

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 Rob Rudloff

ASKER

I just implemented into a large batch file I'm working on and it works perfectly.
(Yes, the format of the "suffix" is always -XX and never -XXX)
Thanks a lot -- I never would have figured that one out.
--- Rob