Robocopy, or "Robust File Copy", is a command-line directory replication command. It has been available as part of the Windows Resource Kit starting with Windows NT 4.0, and was introduced as a standard feature of Windows Vista, Windows 7 and Windows Server 2008.
Do not include a trailing backslash
Good Examples: 
Robocopy C:\InstallationMedia "D:\Backup of InstallationMedia" /copyall /E
Copy directory contents of
bar (including file data, attributes and timestamps), recursively with empty directories (/E):
robocopy C:\foo C:\bar /E
Copy directory recursively (/E), and copy all file information (/COPYALL, equivalent to /COPY:DATSOU, D=Data, A=Attributes, T=Timestamps, S=Security=NTFS ACLs, O=Owner info, U=aUditing info), do not retry locked files (/R:0), preserve original directories’ Timestamps (/DCOPY:T – requires version XP026 or later):
robocopy C:\foo C:\bar /COPYALL /E /R:0 /DCOPY:T
Mirror foo to bar, destroying any files in bar that are not present in foo (/MIR), copy files in restartable mode (/Z) in case network connection is lost:
robocopy C:\foo \\backupserver\bar /MIR /Z
Copy files from one server to another (auto skip files already in the destination)
ROBOCOPY \\Server1\reports \\Server2\backup *.doc /S
List files over 32 MBytes in size:
ROBOCOPY C:\work /MAX:33554432 /L
Move files over 14 days old: (note the MOVE option will fail if any files are open and locked.)
ROBOCOPY C:\work C:\destination /move /minage:14
Backup a Server
The script below copies data from FileServ1 to FileServ2, the destination holds a full mirror along with file security info. When run regularly to synchronize the source and destination, robocopy will only copy those files that have changed (change in time stamp or size.)
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%
Run two robocopy jobs at the same time with START /Min
Start /Min "Job one" Robocopy \\FileServA\C$\Database1 \\FileServeBackupA\c$\BackupsStart /Min "Job two" Robocopy \\FileServB\C$\Database2 \\FileServeBackupB\c$\Backups
How to Use Robocopy to copy security information without copying any file data
By default, Robocopy copies file data for any file that appears to be older, newer, or changed. You can use the /secfix parameter when you run the Robocopy command line to copy only security information for existing files. Additionally, you must use the /xo parameter, the /xn parameter, and the /xc parameter when you run the Robocopy command with the /secfix parameter, for example:
robocopy source destination /secfix /xo /xn /xc
If you run this command line, Robocopy refreshes only the security information for existing files; it does not copy any file data.
If you want to maintain the destination folder as an exact mirror of the source folder, you must run Robocopy with the appropriate parameters to refresh only the file security information, and then run the Robocopy command without using the /xo, the /xn, or the /xc parameters. After you do so, the file data content is consistent between the source file and the destination file.
For definitions of Robocopy terms that are used in this article and for information about other Robocopy functions and features, see Robocopy.doc.