I tried to write a script that copies modified files from my development environment to a desktop folder, but it copies all of the files, not just the modified ones. This is the script:
set codeFolder=C:\Dev\tsg-bto-apps-lt-pc-trunk
FOR /F "TOKENS=1 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET dayOfWeek=%%A
FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET dd=%%B
FOR /F "TOKENS=1,2,3 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET mm=%%C
FOR /F "TOKENS=1,2,3,4 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET yyyy=%%D
SET today=%dd%-%mm%-%yyyy%
Xcopy /Y /D:%today% /I %codeFolder%\bin C:\Users\sheaffer\Desktop\testFolder
The method is as follows:
Get today's date (I used the method that appears in the second answer in the following link: Windows batch: formatted date into variable).
Use Xcopy with the /D flag (there is an example in the following link: http://www.windows-commandline.com/xcopy-command-syntax-examples/)
I can't see what I am doing wrong. The result is that all of the files in my bin folder are copied, and not just files that have been modified today. When I run my script, the command that is generated is:
Xcopy /Y /D:04-11-15 /I C:\Dev\tsg-bto-apps-lt-pc-trunk\bin C:\Users\sheaffer\Desktop\testFolder
Please help me understand my mistake. Thanks.