Get latest 2 files in directory
Posted: 13 Aug 2018 14:04
Hi Folks -
I have a need to grab the names of the (2) NEWEST files in a particular directory. To grab one file name, I'm using the following with success :
My thought is to find the latest then move it to a temp directory, then rerun the above line again to grab the latest. Thoughts?
I have a need to grab the names of the (2) NEWEST files in a particular directory. To grab one file name, I'm using the following with success :
Code: Select all
FOR /F "delims=" %%a IN ('DIR "%OD_CMSO_OPEX_BIN%%%~A*.csv" /B /OD /A-D') DO SET "LATEST=%%~a"