Robocopy /XD switch with wildcards?

Discussion in 'Scripting' started by, Apr 24, 2006.

  1. Guest

    Does anyone know how to use Robocopy.exe using the exclude directory switch
    using wildcards? I've seen mixed information out there about the ability to
    do it. Here is a snippet from my script.

    robocopy.exe c:\source c:\target /XD c:\target\custom

    What I'm looking for is any folder named "custom" with any characters after
    it (such as custom1, custom2) I need excluded from the command. I've tried
    the traditional wildcards "*" and "%" with no luck. I'm using version XP010.

    Anyone know?
, Apr 24, 2006
    1. Advertisements

  2. I don't know for sure, but I think your command might exclude only one
    directory, namely "C:\target\custom". If you wanted to exclude ALL folders
    called custom, try this:

    robocopy.exe c:\source c:\target /XD custom

    or to exclude ALL folders whose names start with custom, try this:

    robocopy.exe c:\source c:\target /XD custom*

    and for testing these settings, try using the "/L" switch.

    Al Dunbar [MS-MVP], Apr 25, 2006
    1. Advertisements

  3. Guest

    Thanks Al, you've hit the nail on the head. I figured this out after banging
    my head on it for a while. I was planning on writing back today.

    Thanks for your response,
, Apr 25, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.