I want to to run xcopy within a DOS script so that it always picks up the current month and year so that my backup only backs up files that have been created or amended since the first of the month. I've got a script that does this but I have to amend it each month to put a new date to xcopy in the /D parameter.
XCOPY C:\MyStuff\*.* C:\MyStuffTemp /E /I /D:01-08-03 /Q
Any ideas how I can code this so I don't have to amend it each month?
Thanks
Clinton
Clinton wrote:the
I want to to run xcopy within a DOS script so that it always picks up
beencurrent month and year so that my backup only backs up files that have
doescreated or amended since the first of the month. I've got a script that
/Dthis but I have to amend it each month to put a new date to xcopy in the
parameter.
XCOPY C:\MyStuff\*.* C:\MyStuffTemp /E /I /D:01-08-03 /Q
Any ideas how I can code this so I don't have to amend it each month?
Thanks
Clinton
<Win2000> c:\cmd>demo\GetMonthandYear
month is 08, year is 2003
two-digit year is 03
<Win2000> c:\cmd>rlist demo\GetMonthandYear.cmd
=====begin c:\cmd\demo\GetMonthandYear.cmd ====================
1. @echo off
2. for /f "tokens=2,4 delims=/ " %%a in (
3. 'date /t'
4. ) do set month=%%a&set year=%%b
5. echo month is %month%, year is %year%
6. echo two-digit year is %year:~2%
=====end c:\cmd\demo\GetMonthandYear.cmd ====================
--
Phil Robyn
Univ. of California, Berkeley
u n z i p m y a d d r e s s t o s e n d e - m a i l
Sysop: | Gate Keeper |
---|---|
Location: | Shelby, NC |
Users: | 712 |
Nodes: | 20 (0 / 20) |
Uptime: | 45:44:47 |
Calls: | 9,004 |
Files: | 5,288 |
D/L today: |
162 files (29,772K bytes) |
Messages: | 463,855 |