Bob
asked on
Copy the three newest files. This batch or script will run every day.
I need to copy the three newest files from a log directory to another. This process will repeat every day at a designated time so I would like to be able to batch this or script this so that it only pulls the three newest files. Can anyone help?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
here a batch .. no points
@echo off
set /a numDONE=0
for /f %%D in ('dir/b/a-d/o-d') do call :sub1 %%D
goto :eof
:sub1
if %numDONE%==3 goto :eof
echo copy %1 place
set /a numDONE+=1
goto :eof
:: DONE
You're welcome!
sew
sew
rpollick, although you've been registered on EE for some time, congratulations on receiving a perfectly accurate solution on your first post. Nicely done sew, that's a great solution.
rpollick, you should now be able to accept the relevant comment as a solution, so the question can be closed. Also note that in future, if you feel that one or comments contributed to your solution, you can accept multiple answers.
Regards,
Rob.
rpollick, you should now be able to accept the relevant comment as a solution, so the question can be closed. Also note that in future, if you feel that one or comments contributed to your solution, you can accept multiple answers.
Regards,
Rob.
ASKER