robocopy
or robocopy.exe
is a command-line tool used to copy files in Windows operating systems. the robocopy is provided by default for the Windows XP, Windows 7, Windows 8, Windows 10, and Windows Server series. What makes the robocopy is the features it provides like multithread higher performance copy or clone operation. The robocopy name comes from the “Robust File Copy” which is created as a replacement for the xcopy command. The robocopy was first released with the Windows NY 4.0 Resource Kit and a standard Windows operating system feature with Windows Vista and Windows Server 2008. Currently, the latest version is 10.0.18.
Robocopy Features
As a complete copy and backup tool robocopy provides following features abilities.
- Copy files and folders over the network with resume capability
- Skip NTFS related errors easily without an infinite loop
- Copy file and folder attributes
- Copy NTFS permissions, owner, auditing information
- Copy file and folder timestamps
- Automatically retry failed copy operations
- Recursive copy
- Sync folders
- Skipping all ready copied or up-to-date files
Display Help Information About Robocopy
The robocopy command or tool provides a lot of different features and options. Help information about these options and features can be displayed with the /? option below.
robocopy /?

robocopy Command Syntax
Robocopy command has the following syntax where the SOURCE and DESTINATION are mandatory.
robocopy SOURCE DESTINATION OPTIONS
- SOURCE is the source location or path which the FILES will be copied from.
- DESTINATION is the destination location to which the FILES will be copied.
- OPTIONS is used to configure copy operation. The robocopy command provides a lot of options that can be categorized as
File Selection
,Retry
,Logging
,Job
. All of them will be provided below.
robocopy Copy Options
The copy options are used to specify different actions.
OPTION | DESCRIPTION |
---|---|
/s | Copy subdirectories skip empty files |
/e | Copy subdirectories include empty files |
/lev:N | Copy N level of the source directories |
/b | Copy backup mode |
/copy:FLAG | Copy with the specified FLAG. FLAG can be an attribute, time stamps, owner information, etc. |
/sec | Copy files with security options or attributes |
/copyall | Copy all file attributes or options |
/purge | Delete destination files and directories which do not exist in the source |
/mir | Mirror files and directories |
/move | Moves files and directories and deletes source |
/a+ATT | Add specified attributes to the copied files |
/a-ATT | Remove specified attributes from the copied files |
/create | Create directories and empty files without data |
/sl | Don’t follow symbolic links |
robocopy Attributes
The robocopy command provides different options that use the file attributes. These attributes are used to set file attributes or specify files with these attributes. These attributes are also called as RASHCNETO
according to their names.
ATTRIBUTE | DESCRIPTION |
---|---|
R | Read-only |
A | Archive |
S | System |
H | Hidden |
H | Hidden |
C | Compressed |
N | Not content indexed |
E | Encrypted |
T | Temporary |
O | Offline |
robocopy File Selection Options
The robocop command provides options in order to select files to be copied.
OPTION | DESCRIPTION |
---|---|
/a | Copy only Archive files |
/ia:ATT | Copy only files with the specified ATT attribute |
/xa:ATT | Skip files with the specified ATT attribute |
/xdDIR | Skip specified DIR directories or path |
/xc | Exclude changed files |
/xn | Exclude newer files |
/xo | Exclude older files |
/max:SIZE | Specify maximum SIZE for size |
/min:SIZE | Specify minimum SIZE for size |
/maxage:AGE | Specify maximum AGE for age |
/minage:AGE | Specify minimum AGE for age |
robocopy Retry Options
The robocopy retry options are used to retry failed copy or clone operations.
OPTION | DESCRIPTION |
---|---|
/r:N | Specify maximum retry which is N count for filed copy |
/w:N | Specify the wait time between retries in seconds with N |
robocopy Logging Options
During the usage of the robocopy command a lot of copy operation is done or not. There will be log information about the operations and this logging information can be managed with the logging options.
OPTION | DESCRIPTION |
---|---|
/l | Only list files or dry runs which will not copy |
/x | Report all extra files which are not selected |
/v | Verbose and detailed output like debug information |
/ts | Display source files time stamps |
/fp | Print full path information |
/bytes | Print file and directory size |
/np | Do not display progress information or bar |
/eta | Print estimated time to copy |
/log:FILE | Specify the log file name and path with the FILE parameter |
/unicode | Set log encoding as Unicode |
/tee | Print log to both console and log file |
robocopy Exit Codes
The robocopy command will provide an exit code when the copy operation is completed. The exit code provides information about the task like no files copied, all files were copied successfully, etc. The exit codes can be very useful for batch file usage in order to get the result of the robocopy command.
Value | Description |
---|---|
0 | No files were copied. No failure was encountered. No files were mismatched. The files already exist in the destination directory; therefore, the copy operation was skipped. |
1 | All files were copied successfully. |
2 | There are some additional files in the destination directory that are not present in the source directory. No files were copied. |
3 | Some files were copied. Additional files were present. No failure was encountered. |
5 | Some files were copied. Some files were mismatched. No failure was encountered. |
6 | Additional files and mismatched files exist. No files were copied and no failures were encountered. This means that the files already exist in the destination directory. |
7 | Files were copied, a file mismatch was present, and additional files were present. |
8 | Several files did not copy. |
Copy All Files and Folders From Source To Destination
The robocopy command can be used to copy all source files and folders into the destination without using any option or providing the file name just providing the source and destination path.
> robocopy C:\Database D:\
The robocopy can be also used to copy files between network shares like below. In the following example the \\DEV\Data
will be copied to another share named \\BACKUP
.
> robocopy \\DEV\Data \\BACKUP\
Copy Specified File Extension
The robocopy command can be used to copy or mirror only specified files type by providing the extension. In the following example, we will copy only the text files.
> robocopy \\DEV\Data \\BACKUP\ *.txt
We can also provide multiple extensions to copy like *.pdf , *.jpg .
> robocopy \\DEV\Data \\BACKUP\ *.txt *.pdf *.jpg
Do Not Copy Only List Files
The robocopy command provides the /l
option in order to list copy log but not copy files really. This is also called a dry run which is just a simulation to show what will happen if the source is copied to the destination.
> robocopy \\DEV\Data \\BACKUP\ *.txt /l
Copy Only Files with Specified Size and Higher
The source files can be copied according to their sizes. By using the /min:
option we will only copy files with 32 MB and higher.
> robocopy \\DEV\Data \\BACKUP\ *.txt /min:33554432
Copy Files Older Than Specified Days
The file date information can be used to select a copy by using the /minage:
option and providing the date count. In the following example, we will copy files that are 10 days and older.
> robocopy \\DEV\Data \\BACKUP\ *.txt /minage:10
Save Options/Parameters To File
The robocopy provides a lot of options that are used on daily basis. Writing these options, again and again, is a trivial task. These options can be saved into a file which is also named a Job file. Then the job file can be read and the same options or parameters are executed. The /save
option is used to specify the save file name.
> robocopy /save:copy_older_files.txt \\DEV\Data \\BACKUP\ *.txt /minage:10
Read Options/Parameters From File
The /job
option can be used to read the text file which contains the job information and provided options and parameters are executed without typing them.
> robocopy /job:copy_older_files.txt
Robocopy GUI
The robocopy is a command-line tool but Microsoft provides a GUI called Robocopy GUI. Also, there are some non-Microsoft GUI alternatives for the robocopy command.
- WinRobocopy
- Easy Robocopy
- Robocopy GUI
- EazyCopy