Robocopy for data moves and backups

Posted on 16th December 2010 by
Sam


Robocopy example scripts and batch files

Using Robocopy for Moving Data and Creating Data Backups.

Robocopy stands for Robust Copy and this it what it is. It is very useful in scheduling the of moving large amounts of data around a network, what’s more it will run continuously, so if you are migrating between file servers it will take changes across as and when they occur. The script is very fast, so you can run just before final data move and new changes will be replicated.

The logs are very intuitive so you can understand if file shares have been missed or locked at anytime.
If you create the script as a batch file, it can be run as a scheduled task. For backup purposes, setup a script for each day of the week and run as a scheduled task, with a different destination.

Download Robocopy from (the robocopy.exe is placed in C:\Program Files\Windows Resource Kits\Tools)http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD&displaylang=en

SAMPLE ROBOCOPY SCRIPTS

 

1. REPLICATION SCRIPT (runs continuously between 1930-0800, if changes are made during this– pauses outside these times)
net use p: \\filesvr\data
cd\
cd Program Files\Windows Resource Kits\Tools
robocopy e:\[source] p:\[destination] /e /z /zb /copy:datsou /purge /XD software /XF priv1.edb /MON:10 /MOT:10 /RH:1930-0800 /log:c:\log.txt

2. BACKUP SCRIPT (runs once and stops)
net use p: \\backsvr\data
cd\
cd Program Files\Windows Resource Kits\Tools
robocopy e:\ [source] p:\[ destination] *.* /V /S /E /COPY:DAT /MIR /Z /NP /XO /R:10 /W:30 /LOG:c:\logs\thursday_files.log

For full Switch Reference see Microsoft’s Guide robocopy.doc (stored in C:\Program Files\Windows Resource Kits\Tools)

By default all Knowall Clients with IT Support Contracts will be advised to utilise RoboCopy as a second, or safety net, form of backups, usually complimenting Offsite Data Backups.