Tech Line

RoboCopy Reassurance

How RoboCopy decides what to replicate.

Chris: Thanks for passing the info on robocopy.exe during the TechMentor conferences. The content mentioned in the robocopy.doc file doesn't tell me what I'm looking for. I'm trying to find out whether robocopy compares the "create date/time," "modified date/time," or "accessed date/time."

Please let me know how to resolve this issue. Thanks!
— John

 

Tech Help—Just An
E-Mail Away

Got a Windows, Exchange or virtualization question or need troubleshooting help? Or maybe you want a better explanation than provided in the manuals? Describe your dilemma in an e-mail to the MCPmag.com editors at mailto:[email protected]; the best questions get answered in this column and garner the questioner with a nifty MCPmag.com baseball-style cap.

When you send your questions, please include your full first and last name, location, certifications (if any) with your message. (If you prefer to remain anonymous, specify this in your message, but submit the requested information for verification purposes.)

John, I completely understand your confusion. RoboCopy.exe is a Windows Resource Kit Tool that can copy folders, folder trees, and files from a source to a local or remote destination. Many organizations use this feature as a quick and dirty way to replicate select file server content to another box. For those of you not familiar with RoboCopy, you can download this tool along with the other Windows Server 2003 Resource Kit Tools at the Windows Server 2003 Resource Kit Tools page. Once downloaded and installed, you will find the 35-page RoboCopy.doc file in the Resource Kit installation folder. By default, this file can be found in "C:\Program Files\Windows Resource Kits\Tools" folder. This file documents the vast array of options available for this tool, as well as many gotchas.

If you're wondering why I'm in agreement with John in his confusion, take a look at the RoboCopy.doc file. While it's a very thorough reference with plenty of excellent examples, it also contains some of the phrases that make network administrators cringe. Here are a couple of my favorites:

  • "In most situations, Robocopy includes these files by default" (page 16)
  • "…some files and directories (such as skipped Same files) might remain in the source tree even when /MOVE is specified" (page 22)

When I hear "In most situations," my first instinct is to wonder about the non-most situations. So the bottom line with RoboCopy is that it may not be a perfect replication tool, but it is free. With proper testing and tweaking, you can arrive at a reliable replication tool for select folders on file servers.

Now to answer your question, when RoboCopy replicates files from a target to a destination, its primary replication criteria is Modified Time. If the file on the source is newer than the file on the target, the source file will be replicated. While the Modified Time attribute is usually sufficient to make a "replicate" or "do not replicate decision," if both files have the same modification time and the source file is larger than the target file, the source will overwrite the target. Any newly created files in the folder being copied via RoboCopy would also be copied.

If you're looking to constantly monitor a folder and replicate files as soon as they are modified, you can use the /MON:n switch. With this switch, RoboCopy will run in the background and after the number of changes specified by the n variable occur, RoboCopy will copy the source files to the target. For example, when executed with /MON:5, after 5 files in the directory tree are modified, those five files would be replicated. This allows you to control replication so that it occurs in bursts. If you are replicating over a WAN and want to limit the times that RoboCopy runs, you can do this by running the command with the /RH:hhmm-hhmm switch. This allows you to setup a time window in which RoboCopy will replicate files. For times outside the window specified by the /RH switch, RoboCopy will sleep.

For more information on RoboCopy, the RoboCopy.doc file mentioned earlier is a good start. Also, if you're looking for a tool that can help you create RoboCopy replication scripts, take a look at RoboCopy GUI 3.0.1. This GUI tool can be used to create a RoboCopy command and save it as a batch script. The GUI tool is not the most intuitive, with each switch just listed as a checkbox in the RoboCopy GUI window, but with a copy of the RoboCopy.doc file handy, you can easily look them up.

Happy RoboCopying!

About the Author

Chris Wolf is a Microsoft MVP for Windows --Virtual Machine and is a MCSE, MCT, and CCNA. He's a Senior Analyst for Burton Group who specializes in the areas of virtualization solutions, high availability, storage and enterprise management. Chris is the author of Virtualization: From the Desktop to the Enterprise (Apress), Troubleshooting Microsoft Technologies (Addison Wesley), and a contributor to the Windows Server 2003 Deployment Kit (Microsoft Press).learningstore-20/">Troubleshooting Microsoft Technologies (Addison Wesley) and a contributor to the Windows Server 2003 Deployment Kit (Microsoft Press).

comments powered by Disqus
Most   Popular