Loading

Sunday, November 15, 2009

How to Copy Files Multi-Threaded with Robocopy in Windows 7

Robocopy, short for Robust File Copy, is a command-line directory replication and file copy command utility that first made available as feature in Windows Vista and Windows Server 2008, although it has been available as part of Windows Resources Kit. In Windows 7 and Windows Server 2008, Robocopy utility is further enhanced with ability to multi-threaded copy operation feature.

Multi-threaded support allows Robocopy to open multiple threads simultaneously, allowing many files to be copied in parallel. With multi-threaded copying, total time required to complete the operation will be drastically reduced and cut, when comparing with with typical copying one file at time in serial sequential order.

As Robocopy is generally a command-line only utility (although a GUI add-on is available for Robocopy), the new multi-threaded operation capability has to be called via a new switch supported by Robocopy. The new multi-threaded copy feature can be enabled and turned on with the following parameter:
/MT[:n]
Where n will instruct Robocopy to do multi-threaded copies with n threads (default 8). The value of n must be at least 1 and not greater than 128 (between 1 to 128), with 1 as single thread. In fact, Robocopy will copy files and folders in multi-threaded operation by default, with 8 threads in one go. Note that /MT[:n] switch is not compatible with the /IPG and /EFSRAW operations.

For example,
robocopy C:\Folder1 C:\Folder2 /MT:32
More Robocopy

6 comments:

  1. Can this version of robocopy be used on Windows 2003 servers?

    ReplyDelete
  2. Absolutely. I've run several versions of robocopy on Windows 2003 servers. In fact, the one I'm running now is version XP010 which I either downloaded or copied from another machine (I don't remember which). robocopy.exe is a stand alone executable which I usually place in the c:\windows\system32 directory since that's where most Windows related exe's reside and it's already in the path. That way you can run it easily from a command prompt. In fact, that's where it resides in Windows 7 and Windows 2008 natively.

    ReplyDelete
  3. I have Windows 7 64-bit and I copied the robocopy from %windir%\syswow64 to a windows 2003 %windir%\system32. It gave an error "This is not a valid win32 application". It's XP027 (v5.1.10.1027). Do you know where I can get the 32bit version?

    Thanks!

    ReplyDelete
  4. You could copy the 32-bit robocopy from a 32-bit version of Windows 7 or Windows 2008. Or, you could download the Windows Server 2003 Resource Kit Tools (http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en) which includes robocopy.exe.

    ReplyDelete
  5. How do I copy a folder (including its contents)? to the target. Right now when I give a command robocopy d:\src e:\target /S - all the contents of d:\src are copied to e:\target. I want the src folder also to be created inside the e:\target\

    ReplyDelete
  6. I am not getting in status in the logs when I use MT

    ReplyDelete