Robocopy
   HOME

TheInfoList



OR:

Robocopy, for "Robust File Copy", is a
command-line A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
directory and/or file replication
command Command may refer to: Computing * Command (computing), a statement in a computer language * COMMAND.COM, the default operating system shell and command-line interpreter for DOS * Command key, a modifier key on Apple Macintosh computer keyboards * ...
for
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
. Robocopy functionally replaces
Xcopy In computing, XCOPY is a command used on IBM PC DOS, MS-DOS, IBM OS/2, Microsoft Windows, FreeDOS, ReactOS, and related operating systems for copying multiple files or entire directory trees from one directory to another and for copying files a ...
, with more options. Created by Kevin Allen and first released as part of the
Windows NT 4.0 Windows NT 4.0 is a major release of the Windows NT operating system developed by Microsoft and oriented towards businesses. It is the direct successor to Windows NT 3.51, which was released to manufacturing on July 31, 1996, and then to retail ...
Resource Kit Resource Kit is a term used by Microsoft for a set of software resources and documentation released for their software products, but which is not part of that product. Resource kits offer supplementary resources such as technical guidance, compatibi ...
, it has been a standard feature of Windows since
Windows Vista Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, which was released five years before, at the time being the longest time span between successive releases of ...
and
Windows Server 2008 Windows Server 2008 is the fourth release of the Windows Server operating system produced by Microsoft as part of the Windows NT family of the operating systems. It was released to manufacturing on February 4, 2008, and generally to retail on Fe ...
. The command is .


Features

Robocopy is noted for capabilities above and beyond the built-in Windows
copy Copy may refer to: *Copying or the product of copying (including the plural "copies"); the duplication of information or an artifact **Cut, copy and paste, a method of reproducing text or other data in computing **File copying **Photocopying, a pr ...
and
xcopy In computing, XCOPY is a command used on IBM PC DOS, MS-DOS, IBM OS/2, Microsoft Windows, FreeDOS, ReactOS, and related operating systems for copying multiple files or entire directory trees from one directory to another and for copying files a ...
commands, including the following, some requiring appropriate command-line options: *Ability to tolerate network interruptions and resume copy (incomplete files are marked with a date stamp of 1970-01-01 and contain a recovery record so Robocopy knows where to continue from). *Ability to skip
NTFS junction point The NTFS file system defines various ways to redirect files and folders, e.g., to make a file point to another file or its contents without making a copy of it. The object being pointed to is called the target. Such file is called a hard or symbo ...
s which can cause copying failures because of infinite loops (/XJ) *Ability to copy file data and attributes correctly, and to preserve original timestamps, as well as NTFS ACLs, owner information, and audit information using the /COPYALL or /COPY:
command line switch A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive command (computing), commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invokin ...
es. *Beginning with the XP026 version, the ability to copy folder (or directory) date and timestamps (/DCOPY:T), even with the ability to update folder timestamps (copied from existing folders) on folders already created from previous versions (that did not copy the folder date and timestamps). *Ability to assert the
Windows NT Windows NT is a proprietary graphical operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems sc ...
"backup right" (/B) so an administrator may copy an entire directory, including files denied readability to the administrator. *Persistence by default, with a programmable number of automatic retries if a file cannot be copied. *A "mirror" mode, which keeps trees synchronised by also deleting files in the destination that are not present in the source. *Ability to skip files already in the destination folder with identical size and timestamp. *A continuously updated command-line progress indicator. *Ability to copy paths exceeding 259 characters — up to a theoretical limit of about 32,000 characters — without errors. *Multithreaded copying introduced with
Windows 7 Windows 7 is a major release of the Windows NT operating system developed by Microsoft. It was released to manufacturing on July 22, 2009, and became generally available on October 22, 2009. It is the successor to Windows Vista, released nearly ...
and
Windows Server 2008 R2 Windows Server 2008 R2 is the fifth version of the Windows Server operating system produced by Microsoft and released as part of the Windows NT family of operating systems. It was released to manufacturing on July 22, 2009, and became General av ...
. *Return code on program termination for
batch file Batch may refer to: Food and drink * Batch (alcohol), an alcoholic fruit beverage * Batch loaf, a type of bread popular in Ireland * A dialect term for a bread roll used in North Warwickshire, Nuneaton and Coventry, as well as on the Wirral ...
usage.


Compression

Since Windows Server 2019 and Windows 10, a compression option is available in robocopy when copying across a network. With this switch, if the destination computer supports SMB compression and the files being copied are very compressible, there may be significant improvements to performance. The SMB compression adds inline whitespace compression to file transfers. Compression is also available with the
xcopy In computing, XCOPY is a command used on IBM PC DOS, MS-DOS, IBM OS/2, Microsoft Windows, FreeDOS, ReactOS, and related operating systems for copying multiple files or entire directory trees from one directory to another and for copying files a ...
command and
Hyper-V Microsoft Hyper-V, codenamed Viridian, and briefly known before its release as Windows Server Virtualization, is a native hypervisor; it can create virtual machines on x86-64 systems running Windows. Starting with Windows 8, Hyper-V superseded W ...
Live Migration Live migration refers to the process of moving a running virtual machine (VM) or application between different physical machines without disconnecting the client or application. Memory, storage, and network connectivity of the virtual machine are ...
with SMB.


Examples of use

Here are some examples of usage, which is not case-sensitive. If more than one option is specified, they must be separated by spaces. * Copy directory contents of the source to the destination (including file data, attributes and timestamps), recursively with empty directories (/E): :Robocopy "C:\Directory A" "C:\Directory B" /E If directory names have non-standard characters, such as spaces, they must be enclosed in double quotes, as is usual in the command line. * Copy directory
recursively Recursion (adjective: ''recursive'') occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in mathematics ...
(/E), copy all file information (/COPYALL, equivalent to /COPY:DATSOU, D=Data, A=Attributes, T=Timestamps, S=Security=
NTFS New Technology File System (NTFS) is a proprietary journaling file system developed by Microsoft. Starting with Windows NT 3.1, it is the default file system of the Windows NT family. It superseded File Allocation Table (FAT) as the preferred fil ...
ACLs, O=Owner info, U=Auditing info), do not retry locked files (/R:0) (the number of retries on failed copies default value is 1 million), preserve original directories' Timestamps (/DCOPY:T - requires version XP026 or later): :Robocopy C:\A C:\B /COPYALL /E /R:0 /DCOPY:T * Mirror A to B, destroying any files in B that are not present in A (/MIR), copy files in resume mode (/Z) in case network connection is lost: :Robocopy C:\A \\backupserver\B /MIR /Z For the full reference, see the Microsoft TechNet Robocopy page.


Syntactic focus on copying folders

Robocopy syntax is markedly different from its predecessors (
copy Copy may refer to: *Copying or the product of copying (including the plural "copies"); the duplication of information or an artifact **Cut, copy and paste, a method of reproducing text or other data in computing **File copying **Photocopying, a pr ...
and
xcopy In computing, XCOPY is a command used on IBM PC DOS, MS-DOS, IBM OS/2, Microsoft Windows, FreeDOS, ReactOS, and related operating systems for copying multiple files or entire directory trees from one directory to another and for copying files a ...
), in that it accepts only folder names, without trailing backslash, as its source and destination arguments. File names and
wildcard character In software, a wildcard character is a kind of placeholder represented by a single character, such as an asterisk (), which can be interpreted as a number of literal characters or an empty string. It is often used in file searches so the full na ...
s (such as * and ?) are not valid as source or destination arguments; files may be selected or excluded using the optional "file" filtering argument (which supports wildcards) along with various other options. For example, to copy two files from folder c:\bar to c:\baz, the following syntax is used: robocopy c:\bar c:\baz file1.txt file2.db And to copy all PDF files from c:\bar to c:\baz: robocopy c:\bar c:\baz *.pdf The files named are copied only from the folder selected for copying; fully qualified path names are not supported. CAUTION: A long-standing issue with Robocopy means that if you back up from the root folder of a drive e.g., the destination files will be given attributes including SH. This means that they will be invisible to normal access (including DIR in cmd.exe). To fix this, add to the robocopy command line - or do an ATTRIB command to remove them afterwards.


Output

Robocopy outputs to the screen, or optionally to a log file, the names of all the directories it encounters, in alphabetical order. Each name is preceded by the number of files in the directory that fulfill the criteria for being copied. If the directory does not yet exist in the target, it is marked "New Dir"; if the directory is empty and the /E option is not used, or it contains no files meeting the criteria, a new directory will not be created. If the /NFL (no file names in log) option is not used, the files being copied will be listed after the name of the directory they are in. At the end of the output is a table giving numbers of directories, files, and bytes. For each of these, the table gives the total number found in the source, the number ''copied'' (including directories marked "New Dir" even if they are not copied), the number ''skipped'' (because they already exist in the target), and the number of ''mismatches'', ''FAILED'', and ''extras''. "Failed" can mean that there was an I/O error that prevented a file being copied, or that access was denied. There is also a row of time taken (in which the time spent on failed files seems to be in the wrong column).


Bandwidth throttling

Robocopy's " inter-packet gap" (IPG) option allows some control over the network bandwidth used in a session. In theory, the following formula expresses the delay (, in milliseconds) required to simulate a desired bandwidth (BD, in
kilobits per second In telecommunications, data-transfer rate is the average number of bits (bitrate), characters or symbols (baudrate), or data blocks per unit time passing through a communication link in a data-transmission system. Common data rate units are multi ...
), over a network link with an available bandwidth of BA kbps: D = \times 512 \times 1000 In practice however, some experimentation is usually required to find a suitable delay, due to factors such as the nature and volume of other traffic on the network. The methodology employed by the IPG option may not offer the same level of control provided by some other bandwidth throttling technologies, such as BITS (which is used by
Windows Update Windows Update is a Microsoft service for the Windows 9x and Windows NT families of operating system, which automates downloading and installing Microsoft Windows software updates over the Internet. The service delivers software updates for Wind ...
and BranchCache).


Limitations

* Robocopy does not copy open files. Any process may open files for exclusive read access by withholding the FILE_SHARE_READ flag during opening. Even Robocopy's ''Backup mode'' will not touch those files. (''Backup mode'' instead runs Robocopy as a "Backup Operator". This allows Robocopy to override permissions settings, specifically, NTFS ACLs). Normally
Volume Shadow Copy Service Shadow Copy (also known as Volume Snapshot Service, Volume Shadow Copy Service or VSS) is a technology included in Microsoft Windows that can create backup copies or snapshots of computer files or volumes, even when they are in use. It is imple ...
is used for such situations, but Robocopy does not use it. Consequently, Robocopy is not suitable for backing up live operating system volumes. However, a separate utility such as 'ShadowSpawn' (Free, Open Sourced, and MIT Licensed) or 'GSCopyPro' () or (included with
Windows Server 2008 Windows Server 2008 is the fourth release of the Windows Server operating system produced by Microsoft as part of the Windows NT family of the operating systems. It was released to manufacturing on February 4, 2008, and generally to retail on Fe ...
), can be used beforehand to create a shadow copy of a given volume, which Robocopy can then back up. * Robocopy versions on systems older than Windows Vista do not mirror properly. They ignore changed security attributes of previously mirrored files. * When specifying the /MT n/code> option to enable multithreaded copying, the /NP option to disable reporting of the progress percentage for files is ignored. By default the MT switch provides 8 threads. The n is the number of threads you specify if you do not want to use the default.


GUI

Although Robocopy itself is a command-line tool,
Microsoft TechNet Microsoft TechNet was a Microsoft web portal and web service for IT professionals. It included a library containing documentation and technical resources for Microsoft products, a learning center which provides online training, discussion forums ...
provided a
GUI The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inste ...
front-end called Robocopy GUI. It was developed by Derk Benisch, a systems engineer with the
MSN Search Microsoft Bing (commonly known as Bing) is a web search engine owned and operated by Microsoft. The service has its origins in Microsoft's previous search engines: MSN Search, Windows Live Search and later Live Search. Bing provides a variet ...
group at Microsoft, and required
.NET Framework The .NET Framework (pronounced as "''dot net"'') is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until bein ...
2.0. It included a copy of Robocopy version XP026. It is no longer available from Microsoft, but may be downloaded from the
Internet Archive The Internet Archive is an American digital library with the stated mission of "universal access to all knowledge". It provides free public access to collections of digitized materials, including websites, software applications/games, music, ...
's
Wayback Machine The Wayback Machine is a digital archive of the World Wide Web founded by the Internet Archive, a nonprofit based in San Francisco, California. Created in 1996 and launched to the public in 2001, it allows the user to go "back in time" and see ...
. There are non-Microsoft GUIs for Robocopy: * Cinchoo's ChoEazyCopy, Simple and powerful RoboCopy GUI v2.0.0.1 (March 11, 2022) * "Easy RoboCopy", latest version 1.0.16 released on January 11, 2022. * "WinRoboCopy" revision 1.3.5953.40896 released on April 19, 2016. * RoboCop RoboCopy, Robocopy GUI Skin and script generator with Progress Monitoring, 10 September 2015. * A program by SH-Soft, also called "Robocopy GUI" v1.0.0.24 (October 8, 2005). Ken Tamaru of Microsoft developed a copying program with functionality similar to Robocopy, called RichCopy, discontinued in 2010. It is not based on Robocopy, and does not require .NET Framework.


Versions

Several versions of Robocopy do not report the version number when executing robocopy /? on the command line. However, their version is stored inside the executable itself and can be queried with PowerShell for example (gcm robocopy , fl *) or inside Windows Explorer by right-clicking on Robocopy.exe, selecting Properties, then clicking on the Details tab.


See also

*
List of file copying software This article provides a list of inbuilt and third party file copying and moving software - utilities and other software used, as part of computer file management, to explicitly move and copy files and other data on demand from one location to an ...
* Command line **
List of DOS commands This article presents a list of commands used by DOS operating systems, especially as used on x86-based IBM PC compatibles (PCs). Other DOS operating systems are not part of the scope of this list. In DOS, many standard system commands were pro ...
**
rsync rsync is a utility for efficiently transferring and synchronizing files between a computer and a storage drive and across networked computers by comparing the modification times and sizes of files. It is commonly found on Unix-like operat ...
* GUI **
SyncToy SyncToy was a freeware tool in Microsoft's PowerToys series that provided an easy-to-use graphical user interface for synchronizing files and folders in Windows versions XP, Vista, 7 and 10. It was written using Microsoft's .NET Framework and us ...
**
Ultracopier Ultracopier is file-copying software for Windows, macOS, and Linux. It supersedes ''SuperCopier''. Features Main features include: *pause/resume transfers *dynamic speed limitation *on-error resume *error/collision management *data security * ...


References


External links

* Official sources *
Microsoft Robocopy documentation

Robocopy download
(Version XP010) as part of Windows Server 2003 Resource Kit Tools. Includes 35-page documentation "robocopy.doc".
Robocopy short documentation
on Microsoft TechNet Library
Robocopy GUI download
(Version 3.1.2.0) on Microsoft TechNet Magazine * Other

{{Windows commands File copy utilities