Jump to content

Robocopy: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m Reverted edits by 71.163.16.37 (talk): unexplained content removal (HG)
Line 54: Line 54:
</ref>)
</ref>)


The Windows [[Volume Shadow Copy]] service is used for such situations, but Robocopy does not use it. Therefore Robocopy is not useful for backing up live operating system volumes. However, one can use a separate utility, such as GSCopyPro or <code>DiskShadow.exe</code><ref>
The Windows [[Volume Shadow Copy]] service is used for such situations, but Robocopy does not use it. Therefore Robocopy is not useful for backing up live operating system volumes. However, one can use a separate utility, such as <code> GSCopyPro </code><ref>
{{cite web
| url = http://www.gurusquad.com/GSCOPYPRO
| title = GSCopyPro
| publisher = GuruSquad
| quote = gscopypro.exe is a tool that works similar to robocopy but has the ability to copy open files.
| accessdate = 2013-03-06
}}
</ref> or <code>DiskShadow.exe</code><ref>
{{cite web
{{cite web
| url = http://technet.microsoft.com/library/cc772172(v=ws.10).aspx
| url = http://technet.microsoft.com/library/cc772172(v=ws.10).aspx

Revision as of 04:03, 20 September 2014

Robocopy
Developer(s)Microsoft
Stable release
6.3
Operating systemWindows NT 4 and later
LicenseFreeware

Robocopy, or "Robust File Copy", is a command-line directory and/or file replication command. Robocopy functionally replaces Xcopy, with more options. It has been available as part of the Windows Resource Kit starting with Windows NT 4.0, and was first introduced as a standard feature in Windows Vista and Windows Server 2008. The command is robocopy.

Features

Robocopy is noted for capabilities above and beyond the built-in Windows copy and xcopy 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 skip NTFS junction points 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 command line switches. (/COPYALL or /COPY:) Copying folder timestamps is also possible in later versions (/DCOPY:T).
  • Ability to assert the Windows NT "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 254 characters — up to a theoretical limit of 32,000 characters — without errors.[1]
  • Multithreaded copying. (Windows 7 and Windows Server 2008 R2) [2]
  • Return code[3] on program termination for batch file usage.

Limitations

No open files

Robocopy will not copy open files. Any process may open files for exclusive read access by withholding the FILE_SHARE_READ[4] 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).[5] [6])

The Windows Volume Shadow Copy service is used for such situations, but Robocopy does not use it. Therefore Robocopy is not useful for backing up live operating system volumes. However, one can use a separate utility, such as GSCopyPro [7] or DiskShadow.exe[8] (included with Windows Server 2008), to create a shadow copy of a given volume, which Robocopy can then be directed to back up.

XP mirroring bug

Robocopy versions on systems older than Windows Vista do not mirror properly. They ignore changed security attributes of previously mirrored files.[9] [10]

Multithread Copy/No Progress Bug

When specifying the /MT[:n] option to enable multithreaded copying, the /NP option to disable reporting of the progress percentage for files is ignored.[11]

Wildcarding treatment

The /XF switch does not work if given both a directory and a wildcard. For example /XF pictures\*.jpg generates an error.

Common usage scenarios

Here are some examples of usage. If more than one option is specified they must be separated by spaces.

  • Copy directory contents of A to B (including file data, attributes and timestamps), recursively with empty directories (/E):
Robocopy C:\A C:\B /E
  • Copy directory recursively (/E), 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)(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.[12]

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 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" (IPG) option allows some control over the network bandwidth used 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 (which is used by Windows Update and BranchCache).

GUI

Although Robocopy itself is a command-line tool, Microsoft TechNet provides a GUI front-end call Robocopy GUI. It was developed by Derk Benisch, a systems engineer with the MSN Search group at Microsoft, and required .NET Framework 2.0.[13] It includes a copy of Robocopy version XP026.

There are other non-Microsoft GUIs for Robocopy:

  • "WinRoboCopy" revision 1.2.5148.1756 released on February 2, 2014.[14]
  • "Easy RoboCopy" latest version 1.0.13 released in January 11, 2012.[15]
  • A program by SH-Soft, also called "Robocopy GUI" v1.0.0.24 (October 8, 2005).[16]

Ken Tamaru of Microsoft has also developed a copying program similar to Robocopy, called RichCopy, which is available on Microsoft TechNet. While it is not based on Robocopy, it offers similar features, and it does not require .NET Framework. [17]

Versions

Note: Several versions of Robocopy do not show the version number when executing Robocopy /? on the command line.

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 © 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, Windows 7 © 1995-2004
6.1 6.1.7601 2009 KB2639043 © 2009
6.2 6.2.9200 2012 Bundled with Windows 8 © 2012
6.3 6.3.9600 2013 Bundled with Windows 8.1 © 2013

See also

References

  1. ^ "Robocopy XP010 FAQ". Windowsitpro.com. 2004-11-15. Retrieved 2012-11-11.
  2. ^ "Multi-threaded robocopy for faster copies - Grant Holliday's Blog - Site Home - MSDN Blogs". Blogs.msdn.com. 2009-10-23. Retrieved 2012-11-11.
  3. ^ "Return codes that are used by the Robocopy utility in Windows Server 2008 or Windows Server 2008 R2". Support.microsoft.com. 2012-02-17. Retrieved 2012-11-11.
  4. ^ http://msdn.microsoft.com/en-us/library/aa363858.aspx "CreateFile function". MSDN. FILE_SHARE_READ [...] Enables subsequent open operations on a file or device to request read access. Otherwise, other processes cannot open the file or device if they request read access.
  5. ^ "Robocopy.exe - Robust File Copy Utility - Version XP010" (PDF). Backup mode copies [...] enable you to copy some files as a Backup Operator that you would not be able to copy as a normal user.
  6. ^ "Default groups". Microsoft TechNet. Backup Operators [...] Members of this group can back up and restore all files [...], regardless of their own individual permissions on those files.
  7. ^ "GSCopyPro". GuruSquad. Retrieved 2013-03-06. gscopypro.exe is a tool that works similar to robocopy but has the ability to copy open files.
  8. ^ "Diskshadow". Microsoft TechNet. Retrieved 2013-03-06. DiskShadow.exe is a tool that exposes the functionality offered by the Volume Shadow Copy Service (VSS).
  9. ^ "Microsoft's Robocopy compromise". ZDNet. 2008-08-04. Retrieved 2012-11-11.
  10. ^ "Ugly bug in Robocopy - ignoring security on file level - Martin Zugec blog". Msmvps.com. 2008-03-03. Retrieved 2012-11-11.
  11. ^ "Robocopy's /MT option disables /NP option". Microsoft TechNet. 2009-12-13. Retrieved 2014-02-26.
  12. ^ "Robocopy". Technet.microsoft.com. Retrieved 2012-11-11.
  13. ^ Joshua Hoffman (November 2006). "Utility Spotlight Robocopy GUI". TechNet Magazine. Microsoft Corporation and CMP Media, LLC. Retrieved 2008-07-17. {{cite news}}: Cite has empty unknown parameter: |coauthors= (help)
  14. ^ "WinRoboCopy - UpWay2Late.com Software". Upway2late.com. Retrieved 2012-11-11.
  15. ^ "Easy RoboCopy". TribbleSoft. Retrieved 2012-11-23.
  16. ^ "SH-RoboCopy GUI". SH-Soft. Retrieved 2012-11-23.
  17. ^ Hoffman, Joshua (November 2006). "Free Utility: RichCopy, an Advanced Alternative to RoboCopy". TechNet Magazine. Microsoft Corporation and CMP Media, LLC. Retrieved 2008-07-17. {{cite news}}: Cite has empty unknown parameter: |coauthors= (help)