Previously, I have used this code and it worked, however this code is deficient as it only copy the log files based on the current date.
Lets say if somebody is seeking for data from the last 24 hours, and he/she runs the program on 24 Jan, 12.01 am, thus all the data from the previous day wont be copied.
Below is the code I have used previously.
Code: Select all
for /F "tokens=1* delims= " %%A in ('DATE/T') do set SYSDATE=%%B
set DATE_YYYY=%SYSDATE:~6,4%
set DATE_MM=%SYSDATE:~3,2%
set DATE_DD=%SYSDATE:~0,2%
set DATE_MM_DD_YYYY=%DATE_MM%-%DATE_DD%-%DATE_YYYY%
echo %DATE_MM_DD_YYYY%
xcopy "w:\documents\*.doc" c:\dest /E /Y /D:%DATE_MM_DD_YYYY%