# .bat to copy files based on today's date



## seperelli (Dec 21, 2011)

I needed some help and found the this thread but needed some extra help.
here you go:

For the date: http://blueonionsoftware.com/blog.aspx?p=40656a9d-021b-4061-b296-36ad5211f4b2
xcopy:http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/xcopy.mspx?mfr=true

my file:
@ECHO OFF
set day=%DATE:~3,2%
set month=%DATE:~6,2%
set year=%DATE:~9,4%
echo today is: %date% 
set all=%month%-%day%-%year%
xcopy "C:\*.* "T:\" /d:%all%
@pause

i used the echo %date% to see what date i had and then i used this to get the day, month and year.

Regards,


----------



## Squashman (Apr 4, 2003)

You haven't really specified what you are having problems with. Nor have you specified if you are receiving some type of error message when you run this batch file. As far as I can tell you are doing it correctly


----------

