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
Post a Comment