General discussion
-
Topic
-
Copy newest file
LockedI need a bat file that will copy only the newest file in a directory. I currently have this:
FOR /F “delims=” %%I IN (‘DIR C:\source*.* /B /O:-D’) DO COPY “%%~fI” “C:\destination”This will sort all files in the directory and then copy them all in order of modified or created date starting with the newest one.
Basically I need it to stop after it copies that first file.
Any suggestions?