Robocopy
Encyclopedia
Robocopy, or "Robust File Copy", is a command-line directory replication command
Command (computing)
In computing, a command is a directive to a computer program acting as an interpreter of some kind, in order to perform a specific task. Most commonly a command is a directive to some kind of command line interface, such as a shell....

. 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 Vista
Windows Vista is an operating system released in several variations developed by Microsoft for use on personal computers, including home and business desktops, laptops, tablet PCs, and media center PCs...

, Windows 7 and Windows Server 2008. The command is robocopy.

Features

Robocopy is notable for capabilities above and beyond the built-in Windows copy
Copy (command)
In computing, copy is a command in RT-11, RSX-11, OpenVMS, DOS, OS/2 and Microsoft Windows operating systems. The command copies computer files from one directory to another. The destination defaults to the current working directory. If more than one source file is indicated, the destination must...

 and xcopy
XCOPY
In computing, Xcopy is a command used on PC DOS, MS-DOS, OS/2, Microsoft Windows, and related operating systems for copying multiple files or entire directory trees from one directory to another and for copying files across a network...

 commands, including the following:
  • Ability to tolerate network interruptions and resume copying. (incomplete files are marked with a date stamp of 1980-01-01 and contain a recovery record so Robocopy knows where to continue from)
  • Ability to copy file data and attributes correctly, and to preserve original timestamps, as well as NTFS ACL
    Access control list
    An access control list , with respect to a computer file system, is a list of permissions attached to an object. An ACL specifies which users or system processes are granted access to objects, as well as what operations are allowed on given objects. Each entry in a typical ACL specifies a subject...

    s, owner information, and audit information using command line switches. (/COPYALL or /COPY:) Copying folder timestamps is also possible in later versions (/DCOPY:T).
  • Ability to assert the Windows NT
    Windows NT
    Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix. It was intended to complement...

     "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 opened.
  • A "mirror" mode, which keeps trees in sync by optionally deleting files out of the destination that are no longer present in the source.
  • Ability to skip files that already appear in the destination folder with identical size and timestamp.
  • A continuously-updated command-line progress indicator.
  • Ability to copy file and folder names exceeding 256 characters — up to a theoretical limit of 32,000 characters — without errors.
  • Multithreaded copying. (Windows 7 only)
  • Return code on program termination for batch file usage.


Notably, Robocopy will fail to copy open files. The so-called Backup mode is sometimes mistaken as an ability to copy open files, which it is not. Backup mode is an administrative privilege that allows Robocopy to override permissions settings (specifically, NTFS ACL
Access control list
An access control list , with respect to a computer file system, is a list of permissions attached to an object. An ACL specifies which users or system processes are granted access to objects, as well as what operations are allowed on given objects. Each entry in a typical ACL specifies a subject...

s) for the purpose of making backups. The Windows Volume Shadow Copy service is the only Windows subsystem that can copy open files, which it does by snapshotting them for point-in-time consistency. Robocopy does not use the Volume Shadow Copy service in any way, limiting its usefulness as a stand-alone backup utility for volumes that may be in use. However, one can use a separate utility, such as VSHADOW or DISKSHADOW (included with Windows Server 2008), to create a shadow copy of a given volume, which Robocopy can then be directed to back up.

On the other hand, by design, the original Robocopy version is not able to replicate security attributes of files which have had their security permissions changed after an initial mirroring. This behavior was changed on Robocopy versions included in Windows 2008 and Windows Vista. The downside of this is that Robocopy does not behave consistently between platforms.

Robocopy cannot exclude files matching a wildcard including a directory e.g. /XF pictures\*.jpg generates an error.

Robocopy also cannot support excluding folders from the root only. e.g. /XD Music excludes both \Music and \Users\Name\Music and /XD \Music excludes nothing.

Common usage scenarios

Copy directory contents of to (including file data, attributes and timestamps), recursively with empty directories (/E):
Robocopy C:\A C:\B /E
Copy directory recursively
Recursion (computer science)
Recursion in computer science is a method where the solution to a problem depends on solutions to smaller instances of the same problem. The approach can be applied to many types of problems, and is one of the central ideas of computer science....

 (/E), and copy all file information (/COPYALL, equivalent to /COPY:DATSOU, D=Data, A=Attributes, T=Timestamps, S=Security=NTFS
NTFS
NTFS is the standard file system of Windows NT, including its later versions Windows 2000, Windows XP, Windows Server 2003, Windows Server 2008, Windows Vista, and Windows 7....

 ACL
Access control list
An access control list , with respect to a computer file system, is a list of permissions attached to an object. An ACL specifies which users or system processes are granted access to objects, as well as what operations are allowed on given objects. Each entry in a typical ACL specifies a subject...

s, 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 restartable mode (/Z) in case network connection is lost:
Robocopy C:\A \\backupserver\B /MIR /Z

It should be noted that using the /Z switch results in marked slowdown of copy operations.
Please see http://technet.microsoft.com/de-de/library/community-edits.rss?topic=cc733145|de-de|10

Folder copier, not file copier

Robocopy syntax is markedly different from standard copy commands, as it accepts only folder names as its source and destination arguments. File names and wild-card characters (such as "*.*") are not valid source or destination arguments. Files may be selected or excluded using the optional filespec
Filespec
In MS-DOS and Microsoft Windows, filespec is a term meaning a filename identifier that specifies both the name and location of a single file.The filespec differs from the filename in that the filespec includes a complete specification, within a particular file system, of the file's location. Thus,...

 filtering argument. Filespecs can only refer to the filenames relative to the folders already selected for copying. Fully qualified path names are not supported.

For example, in order to copy the file foo.txt from directory c:\bar to c:\baz, one could use the following syntax:
Robocopy c:\bar c:\baz foo.txt

Bandwidth throttling

Robocopy's "inter-packet gap
Interframe gap
Ethernet devices must allow a minimum idle period between transmission of Ethernet frames known as the interframe gap , interframe spacing, or interpacket gap . A brief recovery time between frames allows devices to prepare for reception of the next frame...

" (IPG) option allows some control over the network bandwidth utilized in a session. In theory, the following formula expresses the delay (D, in milliseconds) required to simulate a desired bandwidth (BD, in kilobits per second), over a network link with an available bandwidth of BA kbps:



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
Background Intelligent Transfer Service
Background Intelligent Transfer Service is a component of Microsoft Windows XP and later operating systems that facilitates prioritized, throttled, and asynchronous transfer of files between machines using idle network bandwidth...

 (which is utilized by Windows Update
Windows Update
Windows Update is a service provided by Microsoft that provides updates for the Microsoft Windows operating system and its installed components, including Internet Explorer...

 and BranchCache).

GUI front-end

Although Robocopy itself is a command-line tool, Microsoft Technet
Microsoft TechNet
Microsoft TechNet is a Microsoft program and resource for technical information, news, and events for IT professionals. Along with a website, they also produce a monthly subscription magazine titled "TechNet Magazine"....

 has provided a GUI
Gui
Gui or guee is a generic term to refer to grilled dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients. The term derives from the verb, "gupda" in Korean, which literally...

 front-end. The GUI requires the installation of the .NET Framework
.NET Framework
The .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...

 2.0 (40 MB), if it is not already installed. It was developed by Derk Benisch, a systems engineer with the MSN Search group at Microsoft. The Microsoft Robocopy GUI also includes version XP026 of Robocopy (Vista version). When downloaded from the TechNet link below, the version reported is "Microsoft Robocopy GUI 3.1.2."

There are other non-Microsoft GUIs for Robocopy:
  • "WinRoboCopy" revision 108 released in August 10, 2011.
  • "Easy RoboCopy" latest version 1.0.11 released in May 21, 2010.
  • A program by SH-Soft, also called "Robocopy GUI" v1.0.0.24 (October 8, 2005).

A copying program with a GUI, RichCopy
RichCopy
RichCopy is a free computer utility program developed by Ken Tamaru of Microsoft Corporation to copy file directories. It performs more quickly and avoids pitfalls commonly found with the conventional 'copy' and 'paste' commands in the Windows operating system...

, is also available on Microsoft's Technet. While it is not based on Robocopy, it offers similar features, and it does not require the installation of the .NET 2.0 framework.

Versions

Product version File version Year Origin Other
1.70 - 1997 Windows NT Resource Kit
1.71 4.0.1.71 1997 Windows NT Resource Kit
1.95 4.0.1.95 1999 Windows 2000 Resource Kit
1.96 4.0.1.96 1999 Windows 2000 Resource Kit (c) 1995-1997
XP010 5.1.1.1010 2003 Windows 2003 Resource Kit
XP026 5.1.2600.26 2005 Downloaded with Robocopy GUI v.3.1.2
XP027 5.1.10.1027 2008 Bundled with Windows Vista, Server 2008 and later (c) 1995-2004

Email Notifications and Eventlog Entries

A small add-on utility called RoboCopyPlus (see link below) exists that, based on the 'success', 'warning' or 'failure' of the ROBOCOPY job, will send an email notification. It can optionally attach the logfile and can condense it to show warnings and errors only.
The same utility creates eventlog entries that allow for ROBOCOPY to be integrated in network management systems.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK