1

For the windows robocopy command: Can I simultaneously use both /XD "DirectoryName" and /XO (for files older than those already in dest.)

Example:

robocopy /E "K:\clientPack" "C:\clientPack" /XO /XD "K:\clientPack\ClientAndPurleyDriverInjection"

Situation: I have a repository of files that I use in post-imaging tasks on Systems Under Test (SUTs), which I currently use the process below to copy across to the SUT in order to have them available locally, during actual testing, without network being required:

@echo off

if exist C:\clientPack\NUL echo "Folder exists, erasing..."
del /s /f /q c:\clientPack\*.*
for /f %%f in ('dir /ad /b c:\clientPack\') do rd /s /q c:\clientPack\%%f

echo checking for clientPack folder
if not exist C:\clientPack\NUL mkdir C:\clientPack && echo "Folder Created!" 
echo clientPack folder created/detected

echo copying clientPack with drivers
xcopy "K:\clientPack" "C:\clientPack" /e

echo Files copied:
dir C:\clientPack\*.* /b

This works fine when there's plenty of bandwidth... Deleting and recopying from source all the repositories. The problem is, some of the VM targets are having network bandwidth issues. These are experimental systems which I'm still debugging (Ubuntu host using Kernel-VM / Win10 guest), and apparently my google-fu isn't good enough to find a solution.

  • I've used `robocopy` with multiple exclusion types (files and directories, usually) so I know that you can do it. Finding explicit documentation is turning out to be difficult... – sippybear Mar 13 '20 at 21:49
  • That's why I'm here. Documentation only mentions that /MIR is the equivalent of /E /PURGE, with no mentions of any other conflicts. I am aware that multiple /XD and /XF exclusions work fine, but I have no idea about mixing that with age tests. I had no luck finding anything out on forums, either. I may just have to set up a dummy experiment with small files and just see what happens. – James Resoldier Mar 13 '20 at 21:59
  • I finally did just that. I set up some experiments, and found that there is no real limit to the number of exclusions your can make, as long as they are not mutually exclusive, (specifically those mutually exclusive options listed in the documentation). If it's not explicitly listed as incompatible by the documentation, it is implicitly allowed. – James Resoldier Apr 22 '20 at 18:54

1 Answers1

1

Yes, multiple exclusion switches can be used in robocopy from Windows 8.1 on (NOT in Windows Server 2012!). That includes XD, XF and XO. Just write them in the exakt order of how you want them to be used.

If you do not have "plenty of bandwith" I would recommend using /Z as an addiotional parameter; it will save a lot of bandwith when the connection is unstable and the copy process of a file has to be restartet (use /R:<NUM> to configure that).

bjoster
  • 4,423
  • 5
  • 22
  • 32