Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Robocopy appears to do nothing when /MT flag is used

Tags:

robocopy

This command works:

robocopy \\build7\d$ d: *.*  /mir  /XD "System Volume Information"  /XD "$Recycle.Bin" 

But when I try adding the /MT flag:

robocopy \\build7\d$ d: *.*  /mir  /XD "System Volume Information"  /XD "$Recycle.Bin"  /MT

The only output I get is

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows
-------------------------------------------------------------------------------

  Started : Thu Apr 09 09:11:27 2015

   Source : \\build7\d$\
     Dest : D:\

    Files : *.*

 Exc Dirs : System Volume Information
            $Recycle.Bin

  Options : *.* /S /E /COPY:DAT /PURGE /MIR /MT:8 /R:1000000 /W:30

------------------------------------------------------------------------------

It gives me that output, and then just sits there.

I tried using the /LOG flag to redirect the output to a file, but it still just sat there with the same output, only in a file.

Is it doing something in the background that I can't see, or am I doing something wrong?

like image 671
PortMan Avatar asked Apr 09 '15 15:04

PortMan


People also ask

What does MT do in robocopy?

The most important switch to focus on in the above command is /MT, which is the switch that enables Robocopy to copy files in multi-threaded mode. If you do not set a number next to the /MT switch, the default number will be 8, which means that Robocopy will try to copy eight files simultaneously.

How many threads should I use with Robocopy?

Conclusion. Using a multithreaded copy tool like robocopy with 10 threads speeds up file copying and makes sense if you have to copy a large number of files.

Does robocopy copy files in use?

Robocopy does not copy open files. Any process may open files for exclusive read access by withholding the FILE_SHARE_READ flag during opening. Even Robocopy's Backup mode will not touch those files.


1 Answers

In my experience, what you are seeing is normal. When Robocopy runs using multiple threads (/MT), the output is limited to exceptions (new file, extra dir, error, etc...). It will not show you the directory names with the file count that you are probably used to seeing. That means that if the target is largely in-sync with the source, you will not see much output.

I don't know exactly why this is the case. I assume that Robocopy handles the directory walking differently when there are multiple threads involved. This difference probably makes the normal output impossible (or meaningless) to produce.

When I am running Robocopy with multiple threads, I often use the Disk tab in the Windows Resource Monitor to see what Robocopy is doing. How to Use Resource Monitor

like image 77
sarme Avatar answered Oct 05 '22 22:10

sarme