Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Could you please provide me .bat file for copy the latest file from one location to another location.
Example: we have multiple files in the same folder like
1_201701.qvd
1_201702.qvd
2_201701.qvd
2_201702.qvd
Among the above qvd's i want to copy latest qvd i.e. starts with 2_201702.qvd.
Help me in this regard.
Regards,
Ashok
Hey,
Below will pick up newest file from C:/Source and copy it to C:/Destination.
::======= begin batch
@echo off & setlocal
for /r c:\Source %%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 c:\Destination
goto :eof
)
::====== end batch
BR,
Kuba
Thanks Jakub.