ROBOCOPY.exe (Resource Kit)

 

 

Update: You can now find all the ROBOCOPY commands on one page

 

 

 

Below are the limited set of Robocopy options available prior to version XP010:

Syntax
      ROBOCOPY source_folder destination_folder [file(s)_to_copy] [options]

Key
   file(s)_to_copy : A list of files or a wildcard.
                     If no source "file(s)_to_copy" are specified robocopy
                     will default to copying *.*
   Source options
                /S : copy Subfolders
                /E : copy Subfolders, including Empty Subfolders.
              /SEC : copy SECurity info (both source and dest must be NTFS).##

                /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 = n days, else n = YYYYMMDD date).

   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).

                /Z : copy files in restartable mode (survive network glitch).##

              /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+:[R][A][S][H] : set file Attributes on destination files - add.
  /A-:[R][A][S][H] : set file Attributes on destination files - remove.
              /FAT : create destination files using 8.3 FAT file names only.##
           /SECFIX : FIX SECurity info on existing files and dirs.##
           /TimFix : FIX Timestamp on all existing destination files,
                     including skipped files. ##
                     (prior to version 1.95 this was /T it's not backwards compatible
                      so scripts that use /T may fail)

           /CREATE : CREATE directory tree structure + zero-length files only.

            /PURGE : delete dest files/folders that no longer exist in source.
              /MIR : MIRror a directory tree - equivalent to /PURGE plus all subfolders (/E) ##

   Logging options
                /L : List only - don't copy, timestamp or delete any files.
               /NP : No Progress - don't display % copied.
         /LOG:file : output status to LOG file (overwrite existing log). ##
        /LOG+:file : output status to LOG file (append to existing log). ##

Advanced options you'll probably never use
               /XO : eXclude Older - if destination file exists and is the same date
                     or newer than the source - don't bother to overwrite it.
         /XC | /XN : eXclude Changed | Newer files
         /XX | /XL : eXclude eXtra | Lonely files and dirs. 
                     An "extra" file is present in destination but not source, 
                     excluding extras will delete from destination. 
                     A "lonely" file is present in source but not destination
                     excluding lonely will prevent any new files being added to the destination.
               /IS : Overwrite files even if they are already the same.

/XF file [file]... : eXclude Files matching given names/paths/wildcards.##
/XD dirs [dirs]... : eXclude Directories matching given names/paths.    ##
                     XF and XD can be used in combination  e.g.
                     ROBOCOPY c:\source d:\dest /XF *.doc *.xls /XD c:\unwanted /S 

            /MAX:n : MAXimum file size - exclude files bigger than n bytes. ##
            /MIN:n : MINimum file size - exclude files smaller than n bytes.##

/XA:[R][A][S][H] : eXclude files with any of the given Attributes /IA:[R][A][S][H] : Include files with any of the given Attributes ## /X : report all eXtra files, not just those selected & copied. /V : produce Verbose output log, showing skipped files. /ETA : show Estimated Time of Arrival of copied files. ## indicates a new feature in Robocopy version 1.95

The XP and .Net Version of Robocopy (XP010) includes all the above options (with the exception of /SECFIX and /TimFix) and adds a number of new features.

Bugs
Prior to the XP version, Robocopy will fail to copy pathnames over 256 characters in length (UNC paths may be longer than this.)

"The first 90% of a project takes 90% of the time, the last 10% takes the other 90% of the time" - Murphy's Law

Related:

ROBOCOPY



Back to the Top

Simon Sheppard
SS64.com