Copy or Backup Files Faster in Windows 7 or Vista Using Window's Robocopy

(1 vote, average 5.00 out of 5)

In all versions of Windows 7 there is a little known but easy to use utility bundled in called Robocopy.  Why would you want to use Robocopy over just dragging and dropping or copying and pasting files and folders over manually? Here are some reasons why you might want to add Robocopy to your toolbox of useful utilities:

  1. Robocopy is MUCH faster at copying a large number of files from one location to another compared to the built in Windows copy.
  2. Robocopy can intelligently "Backup" (Mirror) a large number of files.
  3. Robocopy can delete a large number of files efficiently as well.

About COPYING:

Why is Robocopy much faster at copying files than the built in Windows copy?  Robocopy supports what is called Multi-Threading. In other words, think of Robocopy as a team of workers moving rocks from one pile to another where as Windows is a single worker moving rocks.  When Windows copies or moves files over, it performs this task one file at a time.  If there is a large file that Windows is moving over, it will spend ALL of its TIME moving just that ONE file despite the fact that there might be 100 smaller files that could be moved quickly.  What Robocopy does is attempt to copy or move 8 files (By default) at the same, so if 1 file is taking a long time, 7 other files can be copied and moved independently.  This results in a significant decrease in the time it takes to copy or move a large number of files when using Robocopy.

About BACKING UP (MIrroring):

Robocopy can also be used to perform simple one to one backups of files; subsequent backups to the same location will be MUCH faster.  Robocopy can be easily configured to check which files and folders exist in the destination (copy to) location that exist (or don't exist anymore) from the source (copy from) location.  Robocopy will skip copying these files if they already exist, add files if they don't exist, and delete files from the destination (copy to) location resulting in FAST simple backups! Awesome! 

About DELETING:

As with copying, Robocopy can be used to delete a large number of files quickly and efficiently too.  Although Robocopy isn't designed to do this, there is a simple trick that can be used to do this as well.  Same principle applies - Multi-Threaded which allows Robocopy to delete multiple files at a time instead of one at a time.

using robocopy to copy, backup, delete files:

So now that you know some basics about Robocopy, lets examine some useful commands and SEE HOW we can use this!

  1. Open the Command Prompt. This can be done by opening up the Start Menu and typing 'cmd' into the "Search Programs and Files" text box.  It will be called "cmd.exe" with a black icon.     
  2. StartRun

  3. You'll get a black windows with C:\WINDOWS\system32\cmd.exe written across the top bar.  Now you're ready to start using Robocopy!
  4. BlankCommand

 

 

 

 

 

 

 

 

 

 

 

 

 

Copying all files and folders from one location to another location:

Type:  "robocopy {source location} {destination location} /E"  

Example:  robocopy C:\exampleSourceFolder1\exampleSourceFolder2  D:\exampleDestinationFolder1 /E

Note:  This will copy "exampleSourceFolder2" including all files and folders inside to "exampleDestionationFolde1".  The "/E" on the end tells Robocopy to copy everything.

 

Backing up all files and folders from one location to another location (Making an exact copy of the source location at the destination location):

Type: "robocopy {source location} {destination location} /E /MIR"

Example:  robocopy C:\exampleSourceFolder1\exampleSourceFolder2  D:\exampleBackupDestinationFolder1 /E /MIR

Note: This will copy "exampleSourceFolder2" including all files and folders inside to "exampleBackupDestinationFolder1".  Files that exist in exampleSourceFolder2 that DO NOT EXIST at the same location inside exampleBackupDestinationFolder1, will be created at the destination location.  Files that EXIST in the destination location that DO NOT EXIST in the source location WILL BE DELETED!  Files that EXIST in exampleSourceFolder2 that EXIST in exampleBackupDestinationFolder1 THAT ARE EXACTLY THE SAME will be SKIPPED (Much faster on subsequent backups to the same location!).  Files that EXIST and are NEWER in the sourceFolder2 than the files that EXIST and are OLDER in the exampleBackupDestionationFolder1 location will be REPLACED! Robocopy will make an exact copy (Clone) of the source folder to the destination folder. So be careful that you're not replacing or deleting files in your backup location that aren't in your source location.  As a simple backup that creates a clone, Robocopy is fast and easy to use.

Deleting a large number of files and folders quickly:

Create an empty folder; for example, C:\MyNewEmptyFolder

Type: "robocopy {empty folder location} {location folder to delete} /E /MIR"

Example: robocopy C:\MyNewEmptyFolder C:\folder1\folder1\MyFolderWIthThousandsOfFiles /E / MIR

Note: Because Robocopy will make the destination folder an exact copy of the source folder, if the source folder is empty, Robocopy will empty the destination folder (including all files and folders inside).

 

There are lots of ways to tweak Robocopy to do things like copying only a specific file type or to ignore files that are in use or locked.  Here are some additional "flags" that you can put at the end of your Robocopy command:

Control the number of retries:  /R:n   Where 'n' is a number (e.g. 1 or 27) of times to retry to copy a file

 Control the length of time to wait before retrying again: /W:n   Where 'n' is a number (1 or 300) representing the number of seconds to wait before retrying.

 Stop Robocopy from getting stuck in a loop:  /XJ

Control the number of "workers" or Threads that Robocopy will try to use:   /MT:n   Where 'n' is a number between 1 and  128

For a list of additional commands, type into the Command Prompt:   robocopy /?   

Partner Links:
Last Updated on Tuesday, 07 February 2012 20:21  
Related Articles

» Oracle 9.2.0 Error: System.Data.OracleClient requires Oracle client software version 8.1.7

ProblemWhen using a version of Oracle 9.2.0 in ASP.NET, attempting to access a site which uses System.Data.OracleClient may give an error with the following exception:  System.Data.OracleClient requires Oracle client software version 8.1.7 or greater This is a common error when using ASP.NET with Oracle -- it is in fact a bug in the default Oracle 9.2.0 installation permissions.  To fix the error, follow the following solution steps (taken from cited source): Log on to...

» How to install Adobe Photoshop CS5 In Ubuntu Linux using WINE

These instructions were tested with Adobe Photoshop CS5.1 (the 30-day trial from Adobe's website) under Ubuntu 11.10 using WINE 1.4-rc5. I was not able to get the installer to work, however the method of installing on Windows and then copying over did work (see ). The directories I copied were:C:\Program Files\Adobe\ C:\Program Files\Common Files\Adobe C:\Program Files (x86)\Adobe C:\Program Files (x86)\Common Files\Adobe C:\Users\All Users\Application Data\Adobe\CS5Note: you must copy each...

» How to Create Personal Folders in Microsoft Outlook 2010

Personal folders are a good way to store email on a hard drive such that they are not affected by an exchange server's retention policy.  Creating a personal folder is Outlook 2010 is easy, but not straight forward.  Here's how to do it:First, open Outlook and navigate to the File tab.  Click the "Account Settings" button, and choose the "Account Settings..." option the dropdown menu.Navigate to the "Data Files" tab, and click the "Add" button:You will see a prompt to save a new...