none
Robocopy Wildcard /XD RRS feed

  • Question

  • Hello,

    How can i tell robocopy to exclude a certain final folder, with the folder above changing.

    I.e in c:\users\USERNAME\appdata\local\microsoft\windows\WER

    I don't want to copy any WER contents, however the USERNAME section of the path obviously changes depending on what user account it is currently backing up... can i use a wildcard at the USERNAME section or how would i do this?

    robocopy \\$compname\c$\users\$tname \\destination\$tname /E /ZB /COPY:DAT /XJ /TEE /R:1 /W:1 /MT:10 /XD \\$compname\c$\users\USERNAME\AppData\Local\Microsoft\Windows\WER.

    Help would be muchly appreciated...

    Tuesday, July 9, 2013 2:29 PM

Answers

  • Hi Tarrley,

    /xf could excludes files that match the specified names or paths. Note that FileName can include wildcard characters (* and ?). Now that there is not all the files in the directory. You could use /xf command to exclude specific files.

    Best regards,

    Karen Hu

    Thursday, July 11, 2013 9:49 AM
    Moderator

All replies

  • Hi Tarrley,

    /xf or /xd command maybe could help you, the detailed information, you can read following article to know well:

    http://technet.microsoft.com/en-us/library/cc733145(v=ws.10).aspx

    Best regards,

    Karen Hu

    Wednesday, July 10, 2013 9:16 AM
    Moderator
  • As you can see i am using /XD XF won't work for me as there not all patterned files...
    Wednesday, July 10, 2013 10:21 AM
  • Hi Tarrley,

    /xf could excludes files that match the specified names or paths. Note that FileName can include wildcard characters (* and ?). Now that there is not all the files in the directory. You could use /xf command to exclude specific files.

    Best regards,

    Karen Hu

    Thursday, July 11, 2013 9:49 AM
    Moderator
  • I know this is old... Did you ever get an answer to this?  Not sure why all the responses were regarding exluding files.  All you have to do is after the /XD switch, type the folder name, e.g.,

    robocopy %source% %destination% *.* /XD WER

    No matter where the folder WER resides in your %source%, any folder named WER will be excluded. You don't have to tell Robocopy exactly where the folder is... if it comes across it, it'll exclude it.  You can also prepend or append an *  as a wild card to the folder name... although, I do believe if the folder name has spaces, like My Documents, then encase in quotes.  So take /XD "*Documents*", for example, robobcopy will exclude any folder with the word "Documents" in its name.


    Robert Harris

    Wednesday, July 22, 2015 9:09 PM
  • Hi Karen,

    It does not accept wildcards:

    C:\Users\147692>ROBOCOPY C:\Users\147692 E:\BKP_Test\147692 /E /COPY:DAT /DCOPY:DAT /XJ /R:0 /LOG+:bkp.log /NS /NC /NFL /NDL /NP /TEE /XD C:\Users\147692\AppData /XF C:\Users\147692\NTUSER*.*
    
     Arquivo de Log: C:\Users\147692\bkp.log
    
    -------------------------------------------------------------------------------
       ROBOCOPY     ::     Robust File Copy para Windows
    -------------------------------------------------------------------------------
    
      Iniciado: segunda-feira, 20 de fevereiro de 2017 13:22:17
       Origem - C:\Users\147692\
         Dest - E:\BKP_Test\147692\
    
        Arquivos:
     Diretórios Exc: C:\Users\147692\AppData
    
      Opções: /NS /NC /NDL /NFL /TEE /S /E /DCOPY:DAT /COPY:DAT /NP /XJ /R:0 /W:30
    
    ------------------------------------------------------------------------------
    
    ERRO: Parâmetro Inválido #18: "C:\Users\147692\NTUSER*.*"
    
                  Uso Simples :: ROBOCOPY origem destino /MIR
    
                       origem :: Diretório de Origem (unidade:\caminho ou
                                 \\servidor\compartilhamento\caminho).
                      destino :: Diretório de Destino  (unidade:\caminho ou
                                 \\servidor\compartilhamento\caminho).
                         /MIR :: espelhar uma árvore de diretório completa.
    
        Para obter mais informações sobre uso, execute ROBOCOPY /?
    
    
    ****  /MIR pode EXCLUIR arquivos e também copiá-los!
    
    C:\Users\147692>

    PS: The error, translated to english, is

      ERROR: Invalid parameter #18: "C:\Users\147692\NTUSER*.*"

    J.Marcelo

    Monday, February 20, 2017 4:25 PM