Robust Copy large files over the network - using ROBOCOPY

Robust Copy large files over the network - using ROBOCOPY

Robust File and Folder Copy.

By default Robocopy will only copy a file if the source and destination have different time stamps or different file sizes.

Syntax 

robocopy source destination [file [file]...] [options]

file(s)_to_copy : A list of files or a wildcard.
                          (defaults to copying *.*)

Source Options:


/S : Copy Subfolders.
                /E : Copy Subfolders, including Empty Subfolders.
 /COPY:copyflag[s] : What to COPY (default is /COPY:DAT)
                      (copyflags : D=Data, A=Attributes, T=Timestamps
                       S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
              /SEC : Copy files with SECurity (equivalent to /COPY:DATS).
          /DCOPY:T : Copy Directory Timestamps.
          /COPYALL : Copy ALL file info (equivalent to /COPY:DATSOU).
           /NOCOPY : Copy NO file info (useful with /PURGE).

                /A : Copy only files with the Archive attribute set.
                /M : like /A, but remove Archive attribute from source files.
            /LEV:n : Only copy the top n LEVels of the source tree.

         /MAXAGE:n : MAXimum file AGE - exclude files older than n days/date.
         /MINAGE:n : MINimum file AGE - exclude files newer than n days/date.
                     (If n < 1900 then n = no of days, else n = YYYYMMDD date).

              /FFT : Assume FAT File Times (2-second date/time granularity).
              /256 : Turn off very long path (> 256 characters) support.

Copy options

/L : List only - don’t copy, timestamp or delete any files. /MOV : MOVe files (delete from source after copying). /MOVE : Move files and dirs (delete from source after copying). /sl : Copy symbolic links instead of the target. /Z : Copy files in restartable mode (survive network glitch). /B : Copy files in Backup mode. /J : Copy using unbuffered I/O (recommended for large files). ## /NOOFFLOAD : Copy files without using the Windows Copy Offload mechanism. ## /ZB : Use restartable mode; if access denied use Backup mode. /IPG:n : Inter-Packet Gap (ms), to free bandwidth on slow lines. /R:n : Number of Retries on failed copies - default is 1 million. /W:n : Wait time between retries - default is 30 seconds. /REG : Save /R:n and /W:n in the Registry as default settings. /TBD : Wait for sharenames To Be Defined (retry error 67).

Destination options

/A+:[RASHCNET] : Set file Attribute(s) on destination files + add. /A-:[RASHCNET] : UnSet file Attribute(s) on destination files - remove. /FAT : Create destination files using 8.3 FAT file names only. /CREATE : CREATE directory tree structure + zero-length files only. /DST : Compensate for one-hour DST time differences. /PURGE : Delete dest files/folders that no longer exist in source. /MIR : MIRror a directory tree - equivalent to /PURGE plus all subfolders (/E)

Advanced Option:

/XL Excludes Lonely files and directories. /IT Includes Tweaked files. /IS Includes Same files. /XC Excludes Changed files. /XN Excludes Newer files. /XO Excludes Older files. /XX Suppresses reporting and processing of Extra files.

Example:

Simple copy of all files from one folder to another:
ROBOCOPY \\Server1\reports \\Server2\backup

Copy files including subfolders (even empty ones /E)  If this command is run repeatedly it will skip any files already in the destination, however it is not a true mirror as any files deleted from the source will remain in the destination.

ROBOCOPY \\Server1\reports \\Server2\backup *.* /E

Robocopy Older and Newer files:

"Newer" means that a file with the same name as the source file already existed in the target folder, and that the source file is newer than the target file (and the source file was copied over the target file). You can prevent these files from being copied by using /XN. Accordingly, "older" means that a file with the same name as the source file already existed in the target folder, and that the source file is older than the target file (and the source file was copied over the target file). You can prevent these files from being copied by using /XO.
Previous
Next Post »
3 Comments
avatar

I think you did an awesome job explaining it. Sure beats having to research it on my own. Thanks
davv ba 2nd year result
davv ba 3rd year result

Balas