Avatar of HBSC
HBSC

asked on 

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

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

Open in new window


 

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

Open in new window


 

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

Open in new window


 

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!
Storage SoftwareMicrosoft Legacy OS

Avatar of undefined
Last Comment
arnold
Avatar of arnold
arnold
Flag of United States of America image

Can you double check the log you've created to make sure that the /S switch you are using is not actually the source of the issue, i.e. the files are copied based on the pattern "*.pst" and the folders that get created are not empty. Do the folders that get created are empty on the source drive??

Use the /L and see what it actually would do without doing it.
Avatar of HBSC
HBSC

ASKER

The folders that get created on the destination are not empty on the source, but they do not contain pst files. Historically with the /S switch, robocopy has treated source folders with no content matching the pattern as empty directories and did not create them on the destination. The behavior is still true if I omit the /MT switch and do a single threaded copy. It's only when I add /MT that it creates all folders. If I run the same command omitting /MT, I see expected behavior with only the folders that contain psts as being created on the destination.

Avatar of HBSC
HBSC

ASKER

Sorry, I forgot to address your question about the log. I checked the logs for both /MT and no /MT. They appear to be identical:

Without MT (did not create extra empty folders):

   Source : w:\
     Dest : v:\becks2\

    Files : *.pst*
	    
  Options : /V /S /COPYALL /B /R:2 /W:1 

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

	  New Dir          0	w:\
	  New Dir          1	w:\akreci\
	    New File  		 976.5 m	archive.pst 100%  
	  New Dir          0	w:\akreci\!JPEGS (new)\
	  New Dir          5	w:\akreci\Archive_Old\
	    New File  		 145.8 m	AKRECI.PST 100%  
	    New File  		 1033216	AKRECI_Archive1.PST 100%  

Open in new window


   
With MT (created the entire folder structure):
Source : w:\
     Dest : v:\becks\

    Files : *.pst*
	    
  Options : /V /S /COPYALL /B /MT:64 /R:2 /W:1 

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

	                   0	w:\
	  New Dir          1	w:\akreci\
	    New File  		 976.5 m	archive.pst 100%  
	  New Dir          0	w:\akreci\!JPEGS (new)\
	  New Dir          5	w:\akreci\Archive_Old\
	    New File  		 145.8 m	AKRECI.PST 100%  
	    New File  		 1033216	AKRECI_Archive1.PST 100%  

Open in new window






Avatar of arnold
arnold
Flag of United States of America image

note both create a !JPEGS directory

I do not know whether the change is windows 7 robocopy version.

Just checked the use of the /S in the same way you have and all the directories in source are created.
Avatar of HBSC
HBSC

ASKER

Yes, the log shows that it's creating the !JPEGS folder on both commands. The folder is not actually created on the singlethreaded run, though. I'll run another test and show the output.

I created a test folder structure. Four folders, two with text files, one folder empty, and one folder with a pst:

E:\1.source>dir /s /b
E:\1.source\1.miscfiles
E:\1.source\2.empty
E:\1.source\3.pst
E:\1.source\4.miscfiles
E:\1.source\1.miscfiles\blah.txt
E:\1.source\1.miscfiles\lkjasdfl.txt
E:\1.source\1.miscfiles\stuff.txt
E:\1.source\3.pst\dummy.pst
E:\1.source\4.miscfiles\blah.txt
E:\1.source\4.miscfiles\lkjasdfl.txt
E:\1.source\4.miscfiles\stuff.txt

Open in new window


Singlethreaded robocopy:

   Source : E:\1.source\
     Dest : E:\2.dest.st\

    Files : *.pst

  Options : /V /TEE /S /COPYALL /B /R:1000000 /W:30

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

                           0    E:\1.source\
          New Dir          0    E:\1.source\1.miscfiles\
          New Dir          0    E:\1.source\2.empty\
          New Dir          1    E:\1.source\3.pst\
100%        New File              12.1 m        dummy.pst
          New Dir          0    E:\1.source\4.miscfiles\

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

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         5         4         1         0         0         0
   Files :         1         1         0         0         0         0
   Bytes :   12.15 m   12.15 m         0         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00

E:\>dir 2.dest.st /s/b
E:\2.dest.st\3.pst
E:\2.dest.st\3.pst\dummy.pst

Open in new window


Multithreaded:
   Source : E:\1.source\
     Dest : E:\2.dest.mt\

    Files : *.pst

  Options : /V /TEE /S /COPYALL /B /MT:2 /R:1000000 /W:30

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

                           0    E:\1.source\
          New Dir          0    E:\1.source\1.miscfiles\
          New Dir          0    E:\1.source\2.empty\
          New Dir          1    E:\1.source\3.pst\
100%        New File              12.1 m        dummy.pst
          New Dir          0    E:\1.source\4.miscfiles\

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

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         5         4         1         0         0         0
   Files :         1         1         0         0         0         0
   Bytes :   12.15 m   12.15 m         0         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00

E:\>dir 2.dest.mt /s/b
E:\2.dest.mt\1.miscfiles
E:\2.dest.mt\2.empty
E:\2.dest.mt\3.pst
E:\2.dest.mt\4.miscfiles
E:\2.dest.mt\3.pst\dummy.pst

Open in new window


The logs show the exact same output, yet the singlethreaded is performing as expected with /S and does not create empty folders based on the specified file pattern. The multithreaded is creating all folders on the destination, including the empty folder on the source. I just ran the same scenarios using the robocopy.exe packaged with 2008 R2 Datacenter, and I get the same results.
Avatar of arnold
arnold
Flag of United States of America image

I do not understand what you are saying both options have these entries:
         New Dir          0    E:\1.source\1.miscfiles\
          New Dir          0    E:\1.source\2.empty\
          New Dir          0    E:\1.source\4.miscfiles\
Avatar of HBSC
HBSC

ASKER

Right, that's what the log shows. The end result is that they are not actually copied, contrary to what the log says. After the single threaded robocopy finished, the destination folder contained the following:

E:\>dir 2.dest.st /s/b
E:\2.dest.st\3.pst
E:\2.dest.st\3.pst\dummy.pst

One folder and one pst file, as expected from the /S command. The multithreaded destination folder contained the following:

E:\>dir 2.dest.mt /s/b
E:\2.dest.mt\1.miscfiles
E:\2.dest.mt\2.empty
E:\2.dest.mt\3.pst
E:\2.dest.mt\4.miscfiles
E:\2.dest.mt\3.pst\dummy.pst

A full copy of the source folder structure.
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of HBSC
HBSC

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of arnold
arnold
Flag of United States of America image

That is what your experience and my attempt confirms.
Microsoft Legacy OS
Microsoft Legacy OS

The Microsoft Legacy Operating System topic includes legacy versions of Microsoft operating systems prior to Windows 2000: All versions of MS-DOS and other versions developed for specific manufacturers and Windows 3/3.1, Windows 95 and Windows 98, plus any other Windows-related versions, and Windows Mobile.

55K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo