Robocopy

Last updated
Robocopy
Other namesRobust File Copy for Windows
Developer(s) Microsoft
Initial release1996, 2728 years ago
Stable release
24H2 (10.0.26100.2161) (October 24, 2024;12 days ago (2024-10-24) [1] ) [±]
Operating system Windows NT 4 and later
Included with Windows Vista and later
Type Command
License Freeware
Website learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy

Robocopy is a command-line file transfer utility for Microsoft Windows. Robocopy is functionally more comprehensive than the COPY command and XCOPY, but replaces neither. Created by Kevin Allen [2] and first released as part of the Windows NT 4.0 Resource Kit, it has been a standard feature of Windows since Windows Vista and Windows Server 2008.

Contents

Features

Robocopy provides features not found in the built-in Windows COPY and XCOPY commands, including the following:

Compression

Since Windows Server 2019 and Windows 10, Robocopy supports SMB compression for transferring files across a network. If the /compress is specified, the destination computer supports SMB compression, and the files being copied are compressible, the operation enjoys significant performance improvements. The SMB compression adds inline whitespace compression to file transfers. Compression is also available with the XCOPY command and Hyper-V live migration with SMB. [8] [9]

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.

Example 1
Copy directory contents of the source Directory A to the destination Directory B (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.
Example 2
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 
Example 3
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. [10]

Syntactic focus on copying folders

Robocopy syntax is markedly different from its predecessors (copy and xcopy), in that it accepts only folder names, without trailing backslash, as its source and destination arguments. File names and wildcard characters (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. [11]

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., robocopy d:\ b:\d-backup\ ....], 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 /a-:SH 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 (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).

Limitations

GUI

Although Robocopy itself is a command-line tool, Microsoft TechNet provided a GUI front-end called Robocopy GUI. It was developed by Derk Benisch, a systems engineer with the MSN Search group at Microsoft, and required .NET Framework 2.0. [18] It included a copy of Robocopy version XP026. It is no longer available from Microsoft, but may be downloaded from the Internet Archive's Wayback Machine. [19]

There are non-Microsoft GUIs for Robocopy:

Ken Tamaru of Microsoft developed a copying program with functionality similar to Robocopy, called RichCopy, this was discontinued in 2010. It is not based on Robocopy, and does not require .NET Framework. [26]

Versions

All versions of Robocopy store their version number and release date in their executable file header, viewable with File Explorer or PowerShell. Some of them (not all) report their version numbers in their textual output.

Product versionFile versionYearBundled with
1.541996Windows NT 4.0 Resource Kit
1.701997Windows NT Resource Kit
1.714.0.1.711997Windows NT Resource Kit
1.954.0.1.951999Windows 2000 Resource Kit
1.964.0.1.961999Windows 2000 Resource Kit
XP0105.1.1.10102003Windows 2003 Resource Kit
XP0265.1.2600.262005Robocopy GUI v.3.1.2
XP0275.1.10.10272008 Windows Vista, Server 2008, 7, 2008 R2
6.16.1.76012009 KB2639043
Same as Windows Windows 8 and later, Windows Server 2012 and later

See also

Related Research Articles

NT File System (NTFS) is a proprietary journaling file system developed by Microsoft in the 1990s.

In computing, a symbolic link is a file whose purpose is to point to a file or directory by specifying a path thereto.

Cabinet is an archive-file format for Microsoft Windows that supports lossless data compression and embedded digital certificates used for maintaining archive integrity. Cabinet files have .cab filename extensions and are recognized by their first four bytes MSCF. Cabinet files were known originally as Diamond files.

<span class="mw-page-title-main">XCOPY</span> Computing command

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 across a network.

<span class="mw-page-title-main">Shadow Copy</span> Microsoft technology for storage snapshots

Shadow Copy 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 implemented as a Windows service called the Volume Shadow Copy service. A software VSS provider service is also included as part of Windows to be used by Windows applications. Shadow Copy technology requires either the Windows NTFS or ReFS filesystems in order to create and store shadow copies. Shadow Copies can be created on local and external volumes by any Windows component that uses this technology, such as when creating a scheduled Windows Backup or automatic System Restore point.

As the next version of Windows NT after Windows 2000, as well as the successor to Windows Me, Windows XP introduced many new features but it also removed some others.

<span class="mw-page-title-main">Microsoft Drive Optimizer</span> Windows utility which defragments a hard drive

Microsoft Drive Optimizer is a utility in Microsoft Windows designed to increase data access speed by rearranging files stored on a disk to occupy contiguous storage locations, a technique called defragmentation. Microsoft Drive Optimizer was first officially shipped with Windows XP.

NTFS links are the abstraction used in the NTFS file system—the default file system for all Microsoft Windows versions belonging to the Windows NT family—to associate pathnames and certain kinds of metadata, with entries in the NTFS Master File Table (MFT). NTFS broadly adopts a pattern akin to typical Unix file systems in the way it stores and references file data and metadata; the most significant difference is that in NTFS, the MFT "takes the place of" inodes, fulfilling most of the functions which inodes fulfill in a typical Unix filesystem.

Contig is a command line defragmentation utility for Windows developed by Microsoft as part of the Sysinternals Suite.

In Microsoft Windows, cacls, and its replacement icacls, are native command-line utilities capable of displaying and modifying the security descriptors on folders and files. An access-control list is a list of permissions for securable object, such as a file or folder, that controls who can access it. The cacls command is also available on ReactOS.

NTBackup is the first built-in backup utility of the Windows NT family. It was introduced with Windows NT 3.51. NTBackup comprises a GUI (wizard-style) and a command-line utility to create, customize, and manage backups. It takes advantage of Shadow Copy and Task Scheduler. NTBackup stores backups in the BKF file format on external sources, e.g., floppy disks, hard drives, tape drives, and Zip drives. When used with tape drives, NTBackup uses the Microsoft Tape Format (MTF), which is also used by BackupAssist, Backup Exec, and Veeam Backup & Replication and is compatible with BKF.

Windows Vista contains a range of new technologies and features that are intended to help network administrators and power users better manage their systems. Notable changes include a complete replacement of both the Windows Setup and the Windows startup processes, completely rewritten deployment mechanisms, new diagnostic and health monitoring tools such as random access memory diagnostic program, support for per-application Remote Desktop sessions, a completely new Task Scheduler, and a range of new Group Policy settings covering many of the features new to Windows Vista. Subsystem for UNIX Applications, which provides a POSIX-compatible environment is also introduced.

<span class="mw-page-title-main">Backup and Restore</span> Primary backup component of Windows Vista and Windows 7

Backup and Restore is the primary backup component of Windows Vista and Windows 7. It can create file and folder backups, as well as system images backups, to be used for recovery in the event of data corruption, hard disk drive failure, or malware infection. It replaces NTBackup, which has been part of Windows since Windows NT 3.51. Unlike its predecessor, it supports CDs, DVDs, and Blu-rays discs as backup media.

A roaming user profile is a file synchronization concept in the Windows NT family of operating systems that allows users with a computer joined to a Windows domain to log on to any computer on the same domain and access their documents and have a consistent desktop experience, such as applications remembering toolbar positions and preferences, or the desktop appearance staying the same, while keeping all related files stored locally, to not continuously depend on a fast and reliable network connection to a file server.

<span class="mw-page-title-main">IExpress</span>

IExpress, a component of Windows 2000 and later versions of the operating system, is used to create self-extracting packages from a set of files. Such packages can be used to install software.

RichCopy is a file copy utility program developed by Ken Tamaru of Microsoft Corporation, discontinued in 2010. It is multi-threaded, which permits it under some circumstances to copy files faster than some other copiers available for the Windows operating system. It provides a complete graphical user interface (GUI), whereas Microsoft's multi-threaded Robocopy is a command-line utility, although there are GUI interfaces for it.

<span class="mw-page-title-main">Windows Server 2012</span> Sixth version of Windows Server, released in 2012

Windows Server 2012, codenamed "Windows Server 8", is the ninth version of the Windows Server operating system by Microsoft, as part of the Windows NT family of operating systems. It is the server version of Windows based on Windows 8 and succeeds Windows Server 2008 R2, which is derived from the Windows 7 codebase, released nearly three years earlier. Two pre-release versions, a developer preview and a beta version, were released during development. The software was officially launched on September 4, 2012, which was the month before the release of Windows 8. It was succeeded by Windows Server 2012 R2 in 2013. Mainstream support for Windows Server 2012 ended on October 9, 2018, and extended support ended on October 10, 2023. Windows Server 2012 is eligible for the paid Extended Security Updates (ESU) program, which offers continued security updates until October 13, 2026.

Server Core is a minimalistic Microsoft Windows Server installation option, debuted in Windows Server 2008. Server Core provides a server environment with functionality scaled back to core server features, and because of limited features, it has reduced servicing and management requirements, attack surface, disk and memory usage. Andrew Mason, a program manager on the Windows Server team, noted that a primary motivation for producing a Server Core variant of Windows Server 2008 was to reduce the attack surface of the operating system, and that about 70% of the security vulnerabilities in Microsoft Windows from the prior five years would not have affected Server Core. Most notably, no Windows Explorer shell is installed. All configuration and maintenance is done entirely through command-line interface windows, or by connecting to the machine remotely using Microsoft Management Console (MMC), remote server administration tools, and PowerShell.

References

  1. "October 24, 2024—KB5044384 (OS Build 26100.2161) Preview". Microsoft Support. Microsoft.
  2. "AMA with Dave Plummer, creator of Task Manager". Reddit.com. 18 December 2020. Retrieved 19 December 2020.
  3. "Robocopy.exe - Robust File Copy Utility - Version XP010" (PDF). Microsoft. 2003. 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.
  4. "Default groups". Microsoft. 6 June 2011. Backup Operators [...] Members of this group can back up and restore all files [...], regardless of their own individual permissions on those files.
  5. Lewis, Dick (15 November 2004). "Robocopy XP010 FAQ". Windows IT Pro. Penton Media. p. 2. Archived from the original on 9 October 2012.
  6. Holliday, Grant (7 December 2009). "Multi-threaded robocopy for faster copies". Grant Holliday's Blog. Microsoft. Archived from the original on 13 August 2018.
  7. Liang, Han; Zou, Lucy; Xu, Simonx (23 February 2023). "Return codes that are used by the Robocopy utility in Windows Server 2008 or Windows Server 2008 R2". Windows Server troubleshooting. Microsoft via Microsoft Learn.
  8. Berkouwer, Sander (7 September 2020). "RoboCopy supports Copying Files over SMB with Compression on Windows Server 2019, and beyond". dirteam.com. Retrieved 14 February 2021.
  9. Smith, Russell (27 November 2020). "SMB Compression Lowers Bandwidth and Improves Copy Times in Windows Server and Azure". Petri.
  10. "Robocopy". Microsoft Technet. 7 June 2020.
  11. "Robocopy". Microsoft Docs. Microsoft. 31 October 2016. Retrieved 14 January 2019.
  12. "CreateFile function". Windows App Development. Microsoft. 9 February 2023 via Microsoft Learn. 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.
  13. "ShadowSpawn". Craig Andera. Retrieved 2015-07-14. ShadowSpawn.exe is an open source MIT licensed tool that creates and manages shadow copies.
  14. "Diskshadow". Microsoft TechNet. 18 April 2012. Retrieved 2013-03-06. DiskShadow.exe is a tool that exposes the functionality offered by the Volume Shadow Copy Service (VSS).
  15. "Microsoft's Robocopy compromise". ZDNet. 2008-08-04. Archived from the original on March 17, 2010. Retrieved 2012-11-11.
  16. "Ugly bug in Robocopy - ignoring security on file level - Martin Zugec blog". Msmvps.com. 2008-03-03. Retrieved 2012-11-11.
  17. "Robocopy's /MT option disables /NP option". Microsoft TechNet. 2009-12-13. Retrieved 2014-02-26.
  18. Joshua Hoffman (November 2006). "Utility Spotlight Robocopy GUI". TechNet Magazine. Microsoft Corporation and CMP Media, LLC. Retrieved 2008-07-17.
  19. "Is Microsoft's Robocopy GUI still available". Windows TenForums. Retrieved 2 May 2022.
  20. Rose, Darren. "PC Assist Software - RoboCopy GUI". www.pcassistsoftware.co.uk. Retrieved 2024-03-08.
  21. Cinchoo (11 March 2022). "Cinchoo's ChoEazyCopy". GitHub.
  22. "Easy RoboCopy". TribbleSoft. Retrieved 2022-05-02.
  23. "WinRoboCopy - UpWay2Late.com Software". Upway2late.com. Retrieved 2012-11-11.
  24. turnssoft (10 September 2015). "RoboCop RoboCopy". SourceForge.
  25. "SH-RoboCopy GUI". SH-Soft. Retrieved 2012-11-23.
  26. Hoffman, Joshua (November 2006). "Free Utility: RichCopy, an Advanced Alternative to RoboCopy". TechNet Magazine. Microsoft Corporation and CMP Media, LLC. Retrieved 2008-07-17.