From Newsgroup: comp.os.ms-windows.misc
Clinton wrote:
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
<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
--- Synchronet 3.18b-Win32 NewsLink 1.113