RoboCopy Of Data Excluding Multiple System Directories

Sometimes we get a requirement to copy the complete volume to other file server and add it in DFSN and DFSR.

When you create a root folder of the volume on other server new volume which has lots of NTFS permissions. It gets difficult to copy the exact ACL on the folder of new volume. If we robocopy the entire volume then we ended up with some system folders which we don't want on our new volume, like $RECYCLE.BIN, System Volume Information and DFSR Private. Cleaning these folders are also time consuming.

You can use /xd filter in robocopy command to exclude all system folders which will reduce you work load while copying the data. Like below,

Command Example:
robocopy.exe <source volume> <destination volume> /b /e /copyall /r:1 /w:1 /xd dir1 dir2 /tee /MT:32

Actual Command:
robocopy.exe "E:" "\\Server1\E$" /b /e /copyall /r:1 /w:1 /xd 'E:\System Volume Information' 'E:\$RECYCLE.BIN' 'E:\Output\DfsrPrivate' /tee /MT:32

PowerShell Output:
-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows
-------------------------------------------------------------------------------

  Started : Thursday, May 4, 2017 12:38:02 PM
   Source : E:\
     Dest : \\SERVER1\E$\

    Files : *.*

 Exc Dirs : E:\System Volume Information
            E:\$RECYCLE.BIN
            E:\Output\DfsrPrivate

  Options : *.* /TEE /S /E /COPYALL /B /MT:32 /R:1 /W:1

1 comments:

  1. Nice blog! for Robocopy the content which is mention in this blog is really understandable and informative. I really like this blog and thanks for sharing.

    ReplyDelete