When it comes to copying large amounts or large in size files and directories many people don’t realise there are better tools for the job then the built in File Explorer used by Windows. Robocopy is a free command line application created by Microsoft that is perfect for copying large or even huge amounts of data between hard drives or over networks.
Robocopy or ‘Robust File Copy’ was first introduced as part of the Windows Resource Kit but has now been included as default in copies of Windows Vista. So what makes
robocopy a better choice then either Windows Explorer, copy or the old DOS
- It can tolerate network outages, retry and attempt to resume the file transfer a set number of times making it perfect for wireless connections.
- Can copy all NTFS attributes including owner and auditing information.
- Has a mirror mode to synchronise the target directory with the source making them identical.
- Uses a detailed verbose mode that keeps you up to date with all the active transfers.
- Is robust and quick, enabling the transferring of many gigabytes worth of data.
- You can throttle it’s bandwidth usage so the file transfers do not hog the network connection.
- Can copy copy destination content of symbolic links.
- It uses the command prompt and has a myriad of options that can be confusing for the first time user.
- You can only copy directories, not individual files (though you can filter out or in types and names of files you don’t want transferred).
Here are a few common attributes I use with Robocopy.
Mirroring a directory with a UNC (network connection) target
robocopy "c:\my source directory" "\\Server\my target directory" /MIR /XF *.bak *.tmp /XA:ST /W:5 /R:5 /MIR MIRrors a directory /XF *.bak or *.tmp Excludes files, in this case anything that has the extensions .bak or .tmp /XA:ST Exclude files with either System or Temporary attributes /W:5 Wait 5 seconds between retries (default is 30 seconds) /R:5 Attempt up to 5 retries on a failed copy (default is normally a million)
If you have shortcuts within your directories and you don’t don’t their destination content transferred you can also use the
/XJ attribute which ‘excludes Junction points’
And if you wanted to copy all the file and directory security details you can use
Copying files within an age bracket
robocopy "c:\my photos" "d:\my recent photos" /NOCOPY /MAXAGE:30 /R:0
Now while the first example used an UNC target but this doesn’t have to be the case. Here we are copying to a different hard drive on the same computer and we’re filtering the files by an age group.
/NOCOPY Ignores the individual file attributes and copies only the files themselves.
/MAXAGE:30 Only copies files that are 30 days old or less.
/R:0 Zero number of retries means if an error is encountered robocopy will skip it and just continue onto the next file.
This is result after I copied over 11,600 images (nearly 28gigs worth) over a 100Mbps ethernet connection using robocopy
Try that with XP’s built in Explorer and you won’t get very far.