• Robocopy switch

    Tags:

    Author
    Topic
    #215152

    Hello — one of the many switches that robocopy has is /xf — to exclude file(s)
    that are to be excluded — the help
    (https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy)

    notes that I can specify “wildcards” * and ? for the filename —

    So I specified the option

    /xf foo.*

    and I got a error that this option was invalid

    Strictly speaking is the help noted that the filename, ie the part of the file identifier before the ‘.’ can have the wildcard and not the file extension/type?

    So, what would be the correct syntax so that robocopy would exclude any file with the filename of “foo” regardless of the filetype

    Thanks in advance

    fpefpe

    Viewing 6 reply threads
    Author
    Replies
    • #215177

      That should have worked, did you try it with *.foo just to see the response?

      • #215259

        “/XF foo.*” should have worked.

        I use the option “/XF ntuser.* *.log” in one of my backup scripts to skip ‘log’ files AND any files with the name ‘ntuser’ without issue.

        You might want to try TribbleSoft’s (free) EasyRoboCopy utility to help trouble shoot.
        http://www.tribblesoft.com/

    • #215189

      no — did not justย  ย “foo*”ย  —ย  robocopy is not forgivingย  — so I have to proceed with extremeย  care

      I seem that your reply is “*.foo”ย  which I not sure if that make sense in my case

      thanks for the help

      fpefpe

      • #215206

        Yeah, I was wondering if it would copy all files with a specific extension. Looks like you found a bug or glaring flaw, these days you almost cannot tell the difference between them.

        You probably need Robocopy for very specific reasons where Xcopy may not apply to your use case.

        Sorry, I could not assist you better at this time.

      • #215266

        Just tested to verify… working on Win 8.1 and Win 10 (1709)

         

    • #215285

      Just checking – you’re specifying your exclusion option after the source and destination, correct? For example:ย  robocopy c:\ d:\ /xf command.*

    • #215317

      @ fpe2fpe

      Don’t know if this helps, but found this reference which seems to show the proper syntax to copy (or exclude?) all files with a given name, regardless of its extension:

      Robocopy Wildcard Examples

      robocopy "C:\Data\" "D:\Data" "book*"

      It puts the file name and the wildcard asterisk in quotes, without the . (dot). It probably *forces* the search to limit itself to only the file name included in the quotes–can not add any file with additional letters, spaces, or names before or after the specified name.

      So, I would guess that the following might work:

      /xf "foo*"

      no โ€” did not just โ€œfoo*โ€ โ€” robocopy is not forgiving โ€” so I have to proceed with extreme care

      Not sure who you’re replying to–I did not see any reference to that syntax in the replies above.

      As far as testing–if you use just the *copy* function and not the */xf* switch–that’s a non-destructive test of creating a *copy only* and should leave the source untouched, is that not correct? Should be able to test if that syntax finds the files you’re interested in limiting robocopy to. Seems like the *exclude function* would also be non-destructive as well!?

      Let us know!

    • #215320

      Well, look at that!

      robocopy "C:\Data\" "D:\Data" "book*"

      /xf "foo*"

      The above coding is neither bbCode, nor HTML coding, so the forum editor *Code* function was allowed to report the code that is enclosed in the boxes.

      1 user thanked author for this post.
    • #215346

      @ fpe2fpe

      So I specified the option

      /xf foo.*

      and I got a error that this option was invalid

      As suggested here:

      Just checking โ€“ youโ€™re specifying your exclusion option after the source and destination, correct? For example: robocopy c:\ d:\ /xf command.*

      You might help out the trouble shooting if you show us the full command line–the *invalid option* may be occurring because of the parameters being specified earlier in your command line!

    • #215357

      Hello — Thanks for all theย  help — per the syntax,ย  ย yes the command is in the correct form

      robocopyย  source dest ….. switches —

      I will they the wildcard without theย  ‘.’ย  soย  I will specify foo* not foo.*

      thanks to all

       

       

       

       

      fpefpe

    Viewing 6 reply threads
    Reply To: Robocopy switch

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: