Friday, September 21, 2012

Configuring MS RoboCopy to schedule ongoing synchronization of files between servers

Robocopy is a utility to copy directories from one server to another.  Commands to use the tool are fairly straightforward and can be added to a batch file to run based on a schedule.

We recently encountered a situation where we needed to sync various files from one server to another on an on-going basis.  To do that we create a folder on the root of our origination server and called it Robocopy.
Within that folder we created a copy.bat file with a very simple argument following the command structure of:
robocopy <Source> <Destination>

Our command specifically says: 
robocopy c:\myFolder \\extranet\c$\myFolder /MIR /LOG+:robo.log
This essentially is saying take everything from the C:\myFolder folder and copy it to the \\extranet server's C:\myFolderfolder.

The /MIR command mirrors a directory tree and the /LOG command tells it to writes the status output to the log file (appends the output to the existing log file).

Schedule the File to Run

In Windows Server 2008 the process of scheduling a batch or job to run is extremely simple.  Just open your Task Scheduler and create a task.  The action in this case is to start a program and then point the path to the .bat file that was created.  That is it!

2 comments:

  1. I would say mostly because people in windows are unaware of it. Rsync is a command-line utility that is consistent with the unix philosophy of having lots of small tools preinstalled. The windows philosophy is based around GUI applications that are all downloaded and installed separately. There is not a smooth integration spot where rsync would be obvious or make much sense, and running commands on a windows system is tedious at best....i am using gs rich copy 360 software for rysync window .

    ReplyDelete