[SoftNAS KB]: Using Robocopy

Robocopy -- Overview and usage

Symptoms

Customer is trying to move a bulk number of file and the robocopy is generating many errors.

Explanation

The Windows client that is running robocopy needs full control permissions to the mounted destination volume.

Resolution

https://wiki.samba.org/index.php/Shares_with_Windows_ACLs#Setup_share_permissions

SeDiskOperatorPrivilege

  • To configure share permissions, you need an account with „SeDiskOperatorPrivilege“. To grant this privilege, e. g. to the „Domain Admin“ group, run the following command on your AD member server(s):

# net rpc rights grant 'SAMDOM\Domain Admins' SeDiskOperatorPrivilege -U'SAMDOM\administrator' -I dc1.samdom.example.com


Existing privileges can be reviewed by

# net rpc rights list accounts -U'SAMDOM\administrator' -I dc1.samdom.example.com
 

Examples:

Examples of Microsoft's Robocopy Syntax

#1 -- To copy contents of C:\UserFolder to C:\FolderBackup:

         Robocopy C:\UserFolder C:\FolderBackup

This is the simplest usage for Robocopy


#2 -- To copy all contents including empty directories of SourceFolder to DestinationFolder:

Robocopy C:\SourceDir C:\DestDir /E


#3 -- List only files larger than 32 MBytes(33553332 bytes) in size.

            Robocopy.exe c:\sourceFolder d:\targetfolder /min:33553332 /l

List only files less than 32 MBytes(33553332 bytes) in size.

          Robocopy.exe c:\sourceFolder d:\targetfolder /max:33553332 /l


Notes:

 -------------------------------------------------------------------------------

   ROBOCOPY     ::     Robust File Copy for Windows                            

-------------------------------------------------------------------------------

              Usage :: ROBOCOPY source destination [file [file]...] [options]

              source :: Source Directory (drive:\path or \\server\share\path).

       destination :: Destination Dir (drive:\path or \\server\share\path).

               file :: File(s) to copy (names/wildcards: default is "*.*").

 More options are shown with:

                C:\ robycopy /?


References:

  1. Robocopy was a part of Windows Resource Kit Tools
  2. Articles 1073 -- Robocopy and a few examples
  3. robocopy :: create backup script
  4. FriendlyRoboCopy: A User’s Guide