Need to copy files across a network? Use RoboCopy

If you are migrating a file server or just have lots of files to copy from one networked machine to another, then instead of using the Windows Explorer method of copying the files, why not use RoboCopy?

If you are migrating a file server or just have lots of files to copy from one networked machine to another, instead of using the Windows Explorer method of copying the files, why not use RoboCopy?

Robocopy is a free tool included with Windows (since Windows Vista). It is a command line tool that takes a number of parameters.  It has the ability to copy file permissions and other file attributes.  The tool can also make a mirror copy of a set of folders or disk drive.

The other great thing about the built in tool is its ability to handle files which are locked or files that you don’t have access to.  If you use the Explorer method and it encounters a locked file, a un-helpful dialog box will be displayed and the file copy process is stopped.  Robocopy ignores the locked files and continues.

Robocopy also has a restart mode that allows you to interrupt a file copy operation and then restart it later on.  It will scan the folders checking to see if there are any new files and then continue where it left off.  This tool is also ideal for migrating file servers, as it deals with the security ACLs and locked files.

Once you have RoboCopy installed you could use the command below to replicate a folder structure.

How to use it

robocopy <source> <destination> /E /Z /COPY:DATS /LOG:C:\\copylog.txt /TEE /R:0 /W:0 /ETA

Example

e.g. copy files from “C:\myfiles” to a network location (note that if your folder name contains any spaces, you will need to wrap the folder name inside quotation marks)

robocopy "C:\myfiles" "\\networkserver\share\myfiles" /E /Z /COPY:DATS /R:0 /W:0

robocopy in action
Robocopy in action

Commonly Used Options

Hopefully the source and destination are self explanatory, although they do need to be the full path of where the files are.

/E – Copies all subdirectories including empty ones.
/Z  – Copies files in restartable mode (that is, restarts the copy process from the point of failure).
/COPY:DATS – Copies file information, Data, Attributes, Timestamp, Security
/SEC – Copies ALL NTFS security information
/LOG:<file> – Generates a log file for auditing
/TEE – Logs to file as well as to the console
/R:0 – Number of times to retry copying a locked file
/W:0 – Time inbetween retry attempts
/ETA – Displays an Estimated time remaining to copy each file.
/MT:8 – Uses multi-threading so several files are copied at the same time (Windows 7 and newer)

There are more command line options that are documented by calling robocopy with the /? parameter.  Alternatively http://ss64.com/nt/robocopy.html has a handy web page version.

 

Similar Posts

  • FEAD Optimizer Extract Tool

    It has finally arrived.  Introducing the FEAD Optimizer Extraction tool. This tool is designed to allow the quick extraction of a FEAD Optimized installer application such as Acrobat Reader.  I am surprised that NetOpSystems who make FEAD have not developed an application for network administrators that will allow easy extraction of the proprietary compressed files. …

  • The Ultimate Boot CD

    For the past year or so, I have been using a magical bootable CD that enabled me to boot a computer into a working version of Windows XP so that I could recover files, run diagnostics or Ghost a hard drive to another machine.  What is this magical CD?

  • PC Emulator Virtual PC

    Have you ever needed to test out a new bit of software or a new version of an operating system but didn’t have a spare computer that you could allocate for the testing?  If so, the solution is simple.  Your computer can run a bit of software that will emulate a computer inside of a…

  • Internet Explorer Proxy settings

    Here is a bit of VB Script that will change the proxy settings of a machine if you are unable to access the Internet Explorer control panel or the Windows Registry. USE AT YOUR OWN RISK

  • Take control of Domain Passwords with Password Control

    There are many ways to change passwords on a Windows Active Directory Domain.  Users can change their own passwords on the workstation.  However for Network administrators there are not any built-in tools for administrating other user network passwords, unless you Remote Desktop to the Domain Controller or have installed the local support tools for Active…