I have to copy the latest or newest files from a server to another server.
I have a code like this
@echo off
set source="\\tsclient\F\Project Documentation"
set target="C:\Users\xyz\Desktop\DS\datafiles"
FOR /F "delims=" %%I IN ('DIR %source%\*.xml /A:-D /O:-D /B') DO COPY %source%\"%%I" %target% & echo %%I & GOTO :END
:END
TIMEOUT 4
The issue is, this will only copy 1 file, there are two new files. How to copy the second one?