Question Locked

Windows 2003 backup batch file

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I have a specific folder C:\munex on a win2003 server that I need backed up everyday to a external hard drive in a enclosure that is connected via a usb port, there are 2 drives involved and they are alternated on a daily basis, how do I write a batch file to let this folder backup at a specific time everyday to the external harddrive. Will this backup be a full backup everyday or will it do an incremental backup?

4 replies

by rob miners

This batch file will do a full Backup the first time that it is run and an incremental Backup afterwards.

Set up a Drive Letter for the Drives. Connect the Drive you are going to use for the Backup. Right click on My Computer, select manage, and then click ?Disk Management.?
Change the drive letter of the drive. Right-click on the drive in the list, and from the resulting menu select "Change Drive Letters and Paths" Click on Change so you can change the drive letter. Click Change.
Select a new drive letter from the drop down list, preferably the one that is not normally used for this drive. EG: U:
If the USB Drives are identical it should allocate the same drive letter.
You can then copy this batch file to the Drive and run it from there. To automate it use the TaskShedular.

munexbck.cmd
=====================
@echo off
:: variables
set path=%~dp0Backup;%path%
set drive=%~dp0Backup
set backupcmd=xcopy /s /c /d /e /h /i /r /k /y

if not exist "%drive%\Backup" mkdir "%drive%\Backup"

if not exist "%drive%\munex" mkdir "%drive%\munex"
%backupcmd% "C:\munex" "%drive%\munex"
======================

< format >

by mmauer

If you want more functions then XCopy use robocopy.

eg (from Wikipedia)

/MIR
Activates mirror mode, deleting any files in the destination that are not present in the source (equivalent to /E and /PURGE).

/Z
Copy files in restartable mode. "Restartable" means Robocopy should write a recovery record inside an incomplete file so if the operation is interrupted or aborted, a future run of Robocopy can resume copying where the previous one left off, instead of starting over at the beginning. This is useful for reliably copying large files or many files over an unreliable network such as a VPN or the Internet. An incomplete file has the same file size as the complete file, and is noted with a date stamp in the file system being within 24 hours of 1980-01-01 00:00

you can get robocopy from Microsoft Windows Server 2003 Resource Kit Tools

http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en

Post if you need help writing the script, I have done a few Robocopy scripts.

Also here is a link to Wiki with all the switches

http://en.wikipedia.org/wiki/Robocopy

This discussion is closed to new replies.