How to pick the latest file to archive in a folder in batch file -


i have multiple files in folder date-wise like: accnt20140127,accnt20140128,accnt20140129,accnt20140130,accnt20140131 etc

i want pick latest file ie. accnt20140131 , copy seperate folder.

can please me on this.

for /f "tokens=*" %%f in (   ' dir /o-n /b /a-d "c:\folder\accnt*"'  ) ( set "filename=%%f"  & goto done ) :done echo "%filename%" 

ordering filename, descending, first file latest. take name , exit for


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -