Home NT Commands
NT Syntax

ROBOCOPY.exe (Resource Kit )

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

In addition to the options supported by earlier versions of Robocopy, version XP010 adds the following:

                /B : copy files in Backup mode.
               /ZB : use restartable mode; if access denied use Backup mode.

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


          /COPYALL : COPY ALL file info (equivalent to /COPY:DATSOU).
           /NOCOPY : COPY NO file info (useful with /PURGE).
              /FFT : assume FAT File Times (2-second granularity).
              /256 : turn off very long path (> 256 characters) support.

            /MON:n : MONitor source; run again when more than n changes seen.
            /MOT:m : MOnitor source; run again in m minutes Time, if changed.

     /RH:hhmm-hhmm : Run Hours - times when new copies may be started.
               /PF : check run hours on a Per File (not per pass) basis.

            /IPG:n : Inter-Packet Gap (ms), to free bandwidth on slow lines.

File Selection Options

               /IT : Include Tweaked files.
               /XJ : eXclude Junction points. (normally included by default).
         /MAXLAD:n : MAXimum Last Access Date - exclude files unused since n.
         /MINLAD:n : MINimum Last Access Date - exclude files used since n.
                     (If n < 1900 then n = n days, else n = YYYYMMDD date).

Logging Options
               /TS : include source file Time Stamps in the output.
               /FP : include Full Pathname of files in the output.
               /NS : No Size - don't log file sizes.
               /NC : No Class - don't log file classes.
              /NFL : No File List - don't log file names.
              /NDL : No Directory List - don't log directory names.
              /TEE : output to console window, as well as the log file.
              /NJH : No Job Header.
              /NJS : No Job Summary.

Job Options
      /JOB:jobname : take parameters from the named JOB file.
     /SAVE:jobname : SAVE parameters to the named job file
             /QUIT : QUIT after processing command line (to view parameters). 
             /NOSD : NO Source Directory is specified.
             /NODD : NO Destination Directory is specified.
               /IF : Include the following Files.

Robocopy 'Jobs' and the 'MOnitor source' option provide an alternative to setting up a Scheduled Task to run a batchfile with a RoboCopy command.

ROBOCOPY will accept UNC pathnames.
Robocopy does not run on Windows 95, or NT 3.5. (RoboCopy is a Unicode application).

Example:

The script below copies data from FileServ1 to FileServ2, the destination holds a full mirror (all files), but when run repeatedly will only copy changed files. (Changed meaning different time stamps or different sizes)

@ECHO OFF
SETLOCAL

SET _source=\\FileServ1\e$\users\

SET _dest=\\FileServ2\e$\BackupUsers\

SET _what=/COPYALL /B /SEC /MIR
:: /COPYALL :: COPY ALL file info
:: /B :: copy files in Backup mode.
:: /SEC :: copy files with SECurity
:: /MIR :: MIRror a directory tree

SET _options=/R:0 /W:0 /LOG:MyLogfile.txt /NFL /NDL
:: /R:n :: number of Retries
:: /W:n :: Wait time between retries
:: /LOG :: Output log file
:: /NFL :: No file logging
:: /NDL :: No dir logging

ROBOCOPY %_source% %_dest% %_what% %_options%

"I live in a lovely, quiet residential area," says a friend of mine who is hunting another place to live. "The only disturbing sound at night is the occasional scream of someone being mugged" - Jane Jacobs

Related Commands:


COPY - Copy one or more files to another location
SCOPY - Copy complete with NTFS Security Permissions
XCOPY - Copy files and folders
Fcopy - File Copy for MMQ (copy changed files & compress. (Win 2K ResKit)
Permcopy - Copy share & file ACLs from one share to another. (Win 2K ResKit)
The Directory Replicator Service - but this requires exclusive access to Netlogon and REPL$.

Equivalent Linux BASH commands:

rsync - Synchronize file trees
remsync - Synchronize remote files
cp - Copy one or more files to another location



Simon Sheppard
SS64.com