On Mon, 24 Jan 2005 09:47:01 -0800, "JohnH-Mo" <(E-Mail Removed)> wrote:
>I backup a folder each night from A to B and once a week wish to offload
>those 7 folders to a second location. I have tried robocopy with the /maxage
>param, but that affects files not folders. The command I tried was:
>robocopy d:\laptop\ /s d:\Weeklytemp /maxage:7.
>
>Does anyone have any other ideas? I guess I could learn how to pass a
>date-7 type of parameter if someone could suggest a good website that
>discusses how to do that.
>
>Thanks in advance.
Using DatePorM.bat from tip 8293 in the 'Tips & Tricks' at
http://www.jsiinc.com
@echo off
setlocal ENABLEDELAYEDEXPANSION
call DatePorM -8 Since
set syyyymmdd=%since:~6,4%%since:~0,2%%since:~3,2%
for /f "Tokens=1,4" %%d in ('dir d:\laptop /AD /TC^|FIND "/"') do (
set dt=%%d
set this=!dt:~6,4!!dt:~0,2!!dt:~3,2!
@echo if "!this!" GEQ "%syyyymmdd%" robocopy "d:\laptop\%%e" /s "d:\weeklytemp\%%e"
)
If your date format is NOT MM/DD/YYYY, you will have to adjust the above.
Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com