Solved Need a batch file to copy newest file from folder

April 22, 2014 at 09:08:27
Specs: Windows 7
Need a batch file to copy newest file from folder and it's subfolders to another folder without taking the directory tree with it.
Copy from f:\fsms\mayberry /s to f:\saved with no directory folders under f:\saved

See More: Need a batch file to copy newest file from folder

Report •

#1
April 22, 2014 at 20:18:14
✔ Best Answer
::======= begin batch RICH.BAT
@echo off & setlocal
for /r f:\fsms\mayberry %%a in (.) do (
call :xx "%%a"
)
goto :eof

:xx
for /f "tokens=*" %%b in ('dir /b /s /o-d /a-d %1') do (
echo copying %%~pnxb having date %%~tb
copy %%~pnxb f:\saved
goto :eof
)
::====== end batch
sort-of tested.


Report •
Related Solutions


Ask Question