New
#1
Need a Batch File to Copy to a Custom Dest Folder
I need help with a batch file to copy the contents of my source dir to the destination dir that is to be created with that days date using xcopy or robocopy. Any help is appreciated!
I need help with a batch file to copy the contents of my source dir to the destination dir that is to be created with that days date using xcopy or robocopy. Any help is appreciated!
This should get you started...
for /F "tokens=1-4 delims=/- " %%A in ('date/T') do set DATE=%%A-%%B-%%C
md c:\tmp\%DATE%
xcopy c:\output c:\tmp\%DATE% /s
Brilliant! Works perfectly. Was wondering though if I can change the date format to something like 2012.06.06?
Yes, the first line splits up the current date into its parts and sets the variable %DATE% to these parts.
So %%C.%%B.%%A will give the year first with dots in between.
Thanks for the this. The format I went with is DATE=%%D.%%B.%%C.
Thanks again. You have saved me a lot of time. I can now schedule it to run automatically.