1.

Solve : Backing up data?

Answer»

I am trying to create a batch file to back up data OLDER than a certain date. Does anyone know how to manipulate dates?

Say, for instance, I want to back up everything that has been modified in the last 7 days but I don't want to hardcode the dates into the batch file.

Thanks for your help and time.if you don't mind getting other tools, you can try xxcopy http://www.xxcopy.com/index.htmQuote

if you don't mind getting other tools, you can try xxcopy http://www.xxcopy.com/index.htm

Thanks.

I would PREFER to do it myself but I'll take a look!

Thanks again.well..if not, maybe you could look at xcopy. There is an option

/D:m-d-y Copies files changed on or after the specified date.
If no date is GIVEN, copies only those files whose
SOURCE time is newer than the destination time.

Guess you could manipulate the m-d-y portion....doing the SUBTRACTING of 7 days or something...just an idea...
good luck playing with dates.Quote
well..if not, maybe you could look at xcopy. There is an option

/D:m-d-y Copies files changed on or after the specified date.
If no date is given, copies only those files whose
source time is newer than the destination time.

Guess you could manipulate the m-d-y portion....doing the subtracting of 7 days or something...just an idea...
good luck playing with dates.

Thanks, that is what I have been looking at so hopefully I am on the right track!!

DATE /T >> y:\backuplog.txt


set day=%date:~0,3%
set month=%date:~3,3%
set year=%date:~6,4%

set yankDate=%month%%day%%year% >> y:\backuplog.txt

xcopy "c:\Documents and Settings\markj" y:\ /D:%yankdate% /C /Y /I /E >>

y:\backuplog.txt


Discussion

No Comment Found