none
Robocopy /MT forcing /E even when you specify /S

    General discussion

  • Hi all. I'm using Robocopy in Win7 SP1. I'm migrating some PST files from one server to another. I do not want to create empty folders. It works perfectly via this command:

     

    robocopy w:\ v:\ "*.pst*" /b /s /copyall /r:5 /w:10 /v /log:e:\robolog.txt

     

    It behaves as it's supposed to by copying only the .pst files and not creating any empty folders where there are no PSTs. For example, let's say I have the following folder structure:

     

    W:\ (root)

    W:\folder1 <- has a PST file

    w:\folder2 <- does NOT have a PST file

     

    When issuing the command above, my destination ends up with Folder1 with the PST file and NOT Folder2, which had no pst files. Now, to speed things up, I'll throw in /MT:12 to run 12 threads:

     

    robocopy w:\ v:\ "*.pst*" /mt:12 /b /s /copyall /r:5 /w:10 /v /log:e:\robolog.txt

     

    It performs the file copies, but it creates all empty folders on the destination as if I had specified the /E switch instead of the /S switch. I am able to reproduce this on several machines and cannot figure out what's wrong. It's as if /MT forces /E. Is this by design or is there a way to get around this? Thanks!

    • Edited by kystin Thursday, October 6, 2011 5:16 PM
    • Changed type Niki HanModerator Tuesday, October 18, 2011 2:48 AM
    Thursday, October 6, 2011 4:27 PM

All replies

  • Hi,

     

    I have tested the situation you mentioned, it seems this is by design to force robocopy /E when using robocopy /MT, I have the same result with you.

     

    I will forward this information to the appropriate department through our internal channel. Both the Microsoft Product Team and Development Team will take into consideration all suggestions and feedback for future releases.

     

    Best Regards,

    Niki

     


    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Wednesday, October 12, 2011 7:04 AM
    Moderator
  • Ah, okay. Thanks, Niki!
    Wednesday, October 12, 2011 2:20 PM
  • I've just tried this, and it works correctly for me.

    I created a folder on my desktop, and then created 2 sub-folders within that folder. In each of these folders, I created a new text document and then edited each document to contain some random text. I then renamed one of these documents, giving it the suffix .pst instead of the normal .txt to simulate the file conditions you have (i.e. 2 folders, one containing a file of type .pst and one containing a file of another type).

    In an elevated command prompt, I then entered the following:

    robocopy "c:\users\<UserName>\desktop\test" "c:\users\<UserName>\desktop\test1" "*.pst" /b /s /copyall /r:5 /w:10 /v /log:c:\users\<UserName>\desktop\rc1.txt

    and

    robocopy "c:\users\<UserName>\desktop\test" "c:\users\<UserName>\desktop\test2" "*.pst" /mt:12 /b /s /copyall /r:5 /w:10 /v /log:c:\users\<UserName>\desktop\rc2.txt

    In both cases, the command executed correctly and again in both cases only the folder (and file within) containing the file with the specified extension, .pst, was copied. The other folder was not copied at all.

    Now, to simulate copying the data to a separate machine, I shall substitute my external drive as the destination, everything else remaining the same:

    robocopy "c:\users\<UserName>\desktop\test" "j:\test1" "*.pst" /b /s /copyall /r:5 /w:10 /v /log:c:\users\<UserName>\desktop\rc3.txt

    and

    robocopy "c:\users\<UserName>\desktop\test" "j:\test2" "*.pst" /mt:12 /b /s /copyall /r:5 /w:10 /v /log:c:\users\<UserName>\desktop\rc4.txt

    Again, in both cases, only the folder (and file within) containing the file with the specified extension, .pst, was copied. The other folder was not copied at all.

    I then added a 3rd sub-folder to my source test folder. This time, I deliberately left it as an empty folder. I then repeated all of the above commands. Again, in all cases, only the folder (and file within) containing the file with the specified extension, .pst, was copied. The other folders were not copied at all.


    • Edited by Dwarf63 Thursday, October 13, 2011 1:09 PM
    Wednesday, October 12, 2011 4:56 PM
  • Thanks for your reply! Which version of robocopy were you using to test? I have tried the copy bundled in Win7 and Server 2008 R2 and they're both behaving like my original post. Thanks!
    Monday, October 17, 2011 1:56 PM
  • Hi,

    Do you have some informations from Microsoft's teams?

    Best Regards

    Thursday, December 22, 2011 2:44 PM
  • Any progress on this issue? I'm still seeing the problem on Win 7 SP1, Robocopy.exe version 5.1.10.1027.

    If you use the /maxage switch along with /mt, then /s doesn't work. You get a copy of every folder in the destination, even if it only contains old files, as if you had used the /e switch.

    Wednesday, March 6, 2013 2:16 PM
  • Thank you for highlighting this - had me stumped as to why /S was doing /E!

    I suspect its by design because the threads overlap and although one thread may not have anything for the folder, another thread might so it creates it just in case.  I also notice that the /MT option stops the logging showing on-screen so it appears to freeze.  Given these points, I am just going to ditch /MT !

    Probably not the response you were hoping for but thank you at least.

    Thursday, June 18, 2015 2:04 PM