Robocopy Version XP010 - Excluding Multiple Directories using /XD
I'm attempting to use Robocopy to routinely copy data between 2 servers. In the file structure being copied there are several folders + their associated sub-folders e.g DfsrPrivate and Projects\Archived for this exampleI don't want to copy. I've attempted to use the switches /XDDfsrPrivate /XD Projects\Archived /XF is also used to exclude all .bak files. (referenced after the 2 /XD switches) This results in the log file header below: ------------------------------------------------------------------------------- ROBOCOPY :: Robust File Copy for Windows :: Version XP010------------------------------------------------------------------------------- Started : Wed Dec 05 00:51:28 2007 Source : \\[Servername]\Data\ Dest : D:\Data\ Files : *.* Exc Files : *.bak Exc Dirs : DfsrPrivate Projects\Archived Options : *.* /S /E /COPYALL /ZB /MAXAGE:1 /R:10 /W:30 ------------------------------------------------------------------------------ This results in theDfsrPrivate being excluded butProjects\Archived and all the subfolders below arenot. Has any one had experience with trying this, and had success?
December 5th, 2007 10:35am

Try: /XD *"DfsrPrivate" *"Projects\Archived"
Free Windows Admin Tool Kit Click here and download it now
February 21st, 2008 1:24pm

I can confirm that the robcopy /XD switch works great, even with the /Purge switch. This way robocopy will not put lots of Access Denied entries in your robocopy log file for the DFS replication private folder DfsrPrivate and all it's sub folders. Here's my example robocopy script using the /XD switch: Set Source=\\okrs0172\ghost$Set Destination=\\okrsvh0100\ghost$Set LogFile=C:\Logs\Base_Image_OKR.txt rem copy _Base and Drivers folders for DFS replication which starts with OKRSVH0100 robocopy %Source%\_Images\XP\_Base %Destination%\_Images\XP\_Base /z /e /np /XD DfsrPrivate /purge /r:10 /w:30 /log:%LogFile% Enjoy, ZippyD
April 17th, 2008 11:05pm

You both missed his point; he has a two-part pathof "Projects\Archived" Yes, one-part paths (ie. actual dir names) work fine (as the OP stated). However, when you don't want all instances of "Archived" to be excluded (just the instance in the "Projects" folder), robocopy does not work as advertised. BTW, jimahs, you should try your recommendations before posting, as *"Projects\Archived" causes robocopy to puke: ERROR : Invalid Parameter #nn : "*Projects\Archived" (yes, even though I placed the asterisk prior to the opening quote, it shows up to the right of the opening quotein the error message) Does anyone out there have any *real* solutions?
Free Windows Admin Tool Kit Click here and download it now
July 5th, 2008 9:27pm

I have found that multi-part paths can be excluded if they are fully qualified, for example: c:\Projects\Archived
September 8th, 2008 10:43pm

I haven't found this - e.g. /XD D:\Testing\Source\DirA\Subdir1 - this switch still results in a DirA\Subdir1 being created and populated with files in my destination.
Free Windows Admin Tool Kit Click here and download it now
September 10th, 2008 3:25am

Using version XP010 of RoboCopy, I was able to copy a root share and exclude multiple folders with one command. The folders I wanted to exclude had common names, so I opted to use full paths. This is my XD switch: Code Snippet /XD G:\RootShare\Level1\SomeFolder "G:\RootShare\Level1\Folder with Spaces" "G:\RootShare\Level4\Some Other Folder" Use the /L switch for testing.....with this /L switch I ran a full test copy of the root share in 60 seconds, for 1TB of data.
October 2nd, 2008 9:53pm

I agree... the full path relative or mapped, and use ""ie /XD "\\server\share\share\" "\\server\share2\share" "\\and so on and so on"works great.. if you are not sure use /l to generate a list and review b4 you run
Free Windows Admin Tool Kit Click here and download it now
December 1st, 2008 8:38pm

I have the same problem too on Windows 2003. I can only exclude the first of 2 long directories with spaces in the path.
June 30th, 2011 5:34pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics