Robocopy /XD switch with wildcards?

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

  1. ML.net

    ML.net 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?
     
    ML.net, Apr 24, 2006
    #1
    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
     
    Al Dunbar [MS-MVP], Apr 25, 2006
    #2
    1. Advertisements

  3. ML.net

    ML.net 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,
     
    ML.net, Apr 25, 2006
    #3
    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.