It is tiring sometimes to transfer and copy files every now and then from your PC’s to hard drives and vice versa. Furthermore, to add more to this hectic work, it may lead to data loss, corrupt files, system hang or anything for that matter. Infact, we are tired of a big-time and thus came across the term Robocopy by Windows that does make things easier.
We have been using this since that very second after researching it a lot and things are quite easier now. Moreover, all you need to do is follow proper codes and syntax for multiple actions. To make it easier for you to we have mentioned each and every detail which you need to know about Robocopy and Robocopy download in Windows 10.
Let’s get started!!
Quick Overlook
What is Robocopy?
Robocopy is a Windows command-line utility that is used to copy a large volume of files and data. It has been in existence since the Windows NT version. Robocopy works by specifying a drive path or server path to copy/move files to a command prompt.
Also known as Robust File Copy, it is a robust, and flexible configuration tool for your Windows operating system. Robocopy is used to mirror tons of directories and directory trees on your system. This tool existed since Windows Vista and continues to do so with much better features and stabilization. You will be glad to know that Robocopy provides more than 80-such command line parameters and switched that carries out multiple functions.
Features
- Capable of syncing two folders
- Can copy paths larger than the 256 character path limit
- Automatically skips already copied files
- Copy Files or move Files on your system
- Copy file in the restartable mode for quick retry later
- Provides more detailed statistics
- Fixes timestamps on existing destination files
Well, there are many more such features associated with Robocopy depending on the user’s request and commands followed.
Robocopy Syntax and Commands
The basic command line or the syntax for Robocopy is as follows.
robocopy <Source> <Destination> [<File>[ …]] [<Options>]
Parameters
The basic parameters for Robocopy command line have been given below.
- <Source> – specifies the path to the directory when needed
- <Destination> – Specifies the path to the destination directory when needed.
- <File> – Specifies the file or files to be copied. You can use wildcard characters (* or ?) if you want. If the File parameter is not specified, *.\* is used as the default value.
- <Options> – Specifies options to be used with the robocopy command.
Common Syntax for Robocopy
Below are some of the common syntax used to copy, move, Retry, Login and File Select options in Robocopy. There are many more available on Microsoft’s official site.
1. Copy Options
Option | Description |
/s | It Copies subdirectories. |
/e | Also, Copies subdirectories. |
/lev:<N> | Only the top N levels of the source directory tree. |
/z | Copies files in restartable mode. |
/b | Copies files in Backup mode. |
/zb | Uses restartable mode. If access is denied, this option uses Backup mode. |
/efsraw | Copies all encrypted files in EFS RAW mode. |
/create | It creates a directory tree and zero-length files only. |
/dcopy:<copyflags> | Defines what to copy for directories. The default is DA. Options are D = data, A = attributes, and T = timestamps. |
/sec | Copies files with security (equivalent to /copy: DATS). |
/copyall | All file information (equivalent to /copy:DATSOU). |
/nocopy | Copies no file information (useful with /purge). |
/secfix | Fixes file security on all files even skipped ones. |
/timfix | Fixes file times on all files even skipped ones. |
/purge | Deletes destination files and directories that no longer exist in the source. |
/mir | Mirrors a directory tree (equivalent to /e plus /purge). |
/mov | Moves files, and deletes them from the source after they are copied. |
/move | Moves files and directories, and deletes them from the source after they are copied. |
2. File Selection Options
Option | Description |
/a | Copies only files for which the Archive attribute is set. |
/m | Copies only files for which the Archive attribute is set, and resets the Archive attribute. |
/xj | Excludes junction points, which are normally included by default. |
/fft | Assumes FAT file times (two-second precision). |
/xc | Excludes changed files. |
/xn | Exclude newer files. |
/xo | Excludes older files. |
/xx | Excludes extra files and directories. |
/xl | Excludes “lonely” files and directories. |
/is | Includes the same files. |
/it | Includes “tweaked” files. |
3. Retry Options
Option | Description |
/r:<N> | Specifies the number of retries on failed copies. The default value of N is 1,000,000 (one million retries). |
/w:<N> | Specifies the wait time between retries, in seconds. The default value of N is 30 (wait time 30 seconds). |
/reg | Saves the values specified in the /r and /w options as default settings in the registry. |
/tbd | Specifies that the system will wait for share names to be defined (retry error 67). |
4. Job Options
Job files are used to save and reuse (usually) long robocopy command lines
Option |
Description |
/job:<JobName> |
Specifies that parameters are to be derived from the named job file. |
/save:<JobName> |
Specifies that parameters are to be saved to the named job file. |
/quit |
Quits after processing the command line (to view parameters). |
/nosd |
It indicates that no source directory is specified. |
/nodd |
It indicates that no destination directory is specified. |
/if |
Includes the specified files. |
5. Exit (Return) Codes
Robocopy uses certain exit codes that indicate the result of the command that follows. Not every file or command executed will always be error-free, so to indicate such errors, we have exit codes. Any exit code greater than seven indicates at least one failure during execution.
Value |
Description |
0 |
No files were copied. None failure was encountered. And 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. |
Understanding the use of Syntax in Robocopy
All the syntax and command listed above adds meaning to the process you want your files to carry out. There are a lot more than you can use but it is not possible to list them all here. So, we will help you understand how you can use them in your system and put it to use.
Let’s take some of the instances and syntax to help you understand how does Robocopy works and how you can use them.
#1 Copy Options in Robocopy
The most basic use of Robocopy is to copy files from source to destination path or folder. You can even copy everything from them including the tons of subfolders and also the BTFS permissions. Furthermore, if you are looking to copy new files, Robocopy does it for you as well.
Here are some of the examples of Robocopy used in certain Use Cases.
1. Copy a Directory
To copy all the files in a directory you can use the command as mentioned below. It will copy all the files including the hidden ones too.
> robocopy C:\src C:\dst
Once you have entered the command the result will be as follows.
2. Copy Directory Structure
If you wish to copy all the files from the directory including the subfolders inside it, run the command given below.
> robocopy C:\src C:\dst /S
Further, if you wish to copy even the empty directories, add the /E switch to complete the process.
> robocopy C:\src C:\dst /S /E
Simply add /COPYALL to the command above to copy the rest of the files that include all NTFS ACLs, file owners and other subfolders including empty ones.
> robocopy C:\src C:\dst /S /E /COPYALL
Delete Copied Files and Directories from Source
Furthermore to delete the copied files and directories from the source, add /MOV switch to delete files and add /MOVE to delete both files & directories. Run commands given below.
>robocopy C:\src C:\dst /S /E /MOV
>robocopy C:\src C:\dst /S /E /MOVE
#2 Syncing Files in Robocopy
Robocopy allows you to sync two directories. This means either ensuring all files in the destination directory are in the source directory and no more. Along with this, the /MIR option will copy all files in the source, not in the destination and delete files in the destination, not in the source. This is something that you need to take care of while using this particular command.
> robocopy C:\src C:\dst /MIR
Robocopy Backup Mode (/b)
There are times when you copy a file in your windows and try to paste it in a destination folder but are denied access to it. While doing so, an error pops up on your screen that you need administrative privileges to access that folder. It may also happen even though you are the admin and still are not being allowed to carry on with the process.
This is where the Robocopy Backup Mode comes into the picture. While this mode allows using the SeBackupPrivilege for reading the files and the SeRestorePrivilege to access any file you need. Also, these commands would allow anyone to copy and access any file without the need for any admin permission.
Robocopy Download
Robocopy comes preinstalled in Windows Vista and Windows 7 and you can use the commands and syntax easily. For Windows XP and Server 2003, this tool can be downloaded as part of the Server 2003 Windows Resource Kit tools. As a result, you can easily download a kit from the Microsoft official site.
Also, the latest version of the Robocopy command line is 10.0.18362 bundled with Windows 10 1903.
For more information on Robocopy simply follow the steps below.
- Click on Windows + R to open Run.
- Type cmd to open a command prompt.
- Type robocopy /? and press Enter.
- All the info about Robocopy will be displayed on the cmd.
Verdict
There is a lot more to know about Robocopy and tons of other commands which you can execute accordingly. You can simply open a command prompt to look at the list of commands and execute them accordingly.
Furthermore, using Robocopy can be a bit complicated which is why you can download the Robocopy GUI to make things simpler. For now, you can easily copy, delete, move, mirror, etc large number of files all at once without having to worry about any data loss on the way using Robocopy.
If you looking for more information on Windows 10 Startup Folder, click here.
Moreover, if you have any issues or errors using Robocopy leave your comments below.