sunhux
asked on
daily MSDOS batch script (.bat/.cmd) to do xcopy/e/c/h/D:d-m-y wrt 1st Sunday of the month
Hi,
I need a daily .bat/.cmd MSDOS script that runs at 1am that will :
a)If it's the first Sunday of the month, do :
xcopy/E/C/H/Y n:\folder1 n:\backup\folder1\yyyymmdd > n:\log\yyyymmdd_folder1.tx t 2>> n:\log\yyyymmdd
xcopy/E/C/H/Y n:\folder2 n:\backup\folder2\yyyymmdd > n:\log\yyyymmdd_folder2.tx t 2>> n:\log\yyyymmdd
(ie take a full backup of folder1 & folder2; yyyymmdd is the date the script run
& n: is a shared drive/folder)
b)If it's other days, do :
xcopy/E/C/H/Y/D:d-m-y n:\folder1 n:\backup\folder1\yyyymmdd > n:\log\yyyymmdd_folder1.tx t 2>> n:\log\yyyymmdd
xcopy/E/C/H/Y/D:d-m-y n:\folder2 n:\backup\folder1\yyyymmdd > n:\log\yyyymmdd_folder2.tx t 2>> n:\log\yyyymmdd
(this is a differential backup to backup files that have been modified or created since the
last first Sunday of the month)
c)
in step (a) above, if it's the first Sunday of the month, it would delete away (using "deltree ?")
the folders that are 5 months old & subsequent differential backups' folders with respect to
that full backup's date.
Purpose of the >> and 2>> is to create logs for review next morning if there's
errors with backup.
If you need to break this up into multiple scripts, it's fine with me.
Single script would be nice but not essential
I need a daily .bat/.cmd MSDOS script that runs at 1am that will :
a)If it's the first Sunday of the month, do :
xcopy/E/C/H/Y n:\folder1 n:\backup\folder1\yyyymmdd
xcopy/E/C/H/Y n:\folder2 n:\backup\folder2\yyyymmdd
(ie take a full backup of folder1 & folder2; yyyymmdd is the date the script run
& n: is a shared drive/folder)
b)If it's other days, do :
xcopy/E/C/H/Y/D:d-m-y n:\folder1 n:\backup\folder1\yyyymmdd
xcopy/E/C/H/Y/D:d-m-y n:\folder2 n:\backup\folder1\yyyymmdd
(this is a differential backup to backup files that have been modified or created since the
last first Sunday of the month)
c)
in step (a) above, if it's the first Sunday of the month, it would delete away (using "deltree ?")
the folders that are 5 months old & subsequent differential backups' folders with respect to
that full backup's date.
Purpose of the >> and 2>> is to create logs for review next morning if there's
errors with backup.
If you need to break this up into multiple scripts, it's fine with me.
Single script would be nice but not essential
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
15-10-2008