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

  • Windows Update or Microsoft Update

    Those of you who regularly use the Windows Update feature of Windows XP may have noticed that Microsoft have now created an enhanced version of the automated update tool. Microsoft Update has the ability to update any Microsoft application and not just Windows.

  • 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

  • Internet Explorer Max Connections

    If you are using a broadband connection it can be quite frustrating having to wait for Internet Explorer to finish rendering a web page.  Internet Explorer has a built in limit to the number of items that can be downloaded at any one time.  This limitation has been defined as part of the HTTP Specifications. …

  • cURL error 28: Connection timed out

    One of my work WordPress sites is hosted internally and requires an upstream proxy to access the internet. I’ve had issues with the CRON jobs failing and the cURL error 28 message appearing, but never managed to figure out the issue until now. WordPress 5.1 brought in a new feature in the Tools menu called…

  • Netopsystems – FEAD Optimizer – Command Line

    FEAD Optimizer is a system that is used to compress installation files into a highly compact distributable file.  The intention is of course to save on bandwidth and make installation a lot more reliable.  The FEAD compressed file works sort of like an executable ZIP file.  But unlike a ZIP file there are no third party…