Robocopy is Windows’ command-line utility for copying files and directory trees. A safe starting point is to specify the source and destination, choose whether empty folders should be included, set a deliberate retry policy, and save a log. Be especially careful with /MIR: it mirrors the source by purging destination-only files and folders.
What Robocopy does and how to form a command
Microsoft describes Robocopy as a tool that “Copies file data from one location to another.” Its documented syntax is:
robocopy <source> <destination> [<file>[ ...]] [<options>]
The source and destination are directory paths. The optional file argument accepts wildcards; if omitted, Robocopy uses *.*. Put quotation marks around paths containing spaces. Microsoft lists the command for Windows 10 and 11, Windows Server 2016, 2019, 2022, and 2025, and Azure Local 2311.2 and later. See the Microsoft Learn Robocopy reference for the current syntax and option details.
How do I copy a folder with Robocopy?
For a recursive copy that includes empty subdirectories, use /E. Add explicit retry settings and a log path for a repeatable run:
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
robocopy "C:Source Folder" "D:Backup Folder" /E /R:2 /W:5 /LOG:"C:Logscopy.log"
Replace the example paths and select retry values suitable for the job. The command copies the contents of the source folder into the destination; it does not require a specific kind of storage device. Ensure the log directory exists and that the account running the command can write to it.
- Choose the source directory and the destination directory, and check both paths carefully.
- Choose
/Sif you want subdirectories but not empty ones, or/Eif empty directories should also be copied. - Set
/R:nfor the retry count and/W:nfor the wait between retries rather than relying on the lengthy defaults. - Add
/LOG:pathto create a log, then run the command and inspect the log and return code.
Choose the traversal behavior—and understand /MIR
| Option | Behavior | Use when |
|---|---|---|
/S |
Copies subdirectories but omits empty directories. | Empty folder structure is not needed. |
/E |
Copies subdirectories, including empty directories. | You want the destination to include the source folder structure without purging destination-only content. |
/MIR |
Equivalent to /E plus /PURGE; removes files and directories that exist only in the destination. |
You intend to make the destination mirror the source and accept the deletion of destination-only content. |
Before using /MIR, verify the source and destination arguments and decide whether extra destination content may be removed. If you need synchronization without purging destination-only files, do not use /MIR or /PURGE; instead, select suitable filters and review the resulting behavior.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Choose restart, retry, and concurrency options
| Option | Documented behavior | Considerations |
|---|---|---|
/Z |
Uses restartable mode, which can resume an interrupted file copy. | Useful when an interruption is possible, such as during a network transfer. |
/B |
Uses backup mode, overriding file and folder permission settings that might otherwise block access. | Use only when the task requires backup privileges; it is not a routine default. |
/ZB |
Starts in restartable mode and switches to backup mode if access is denied. | Microsoft’s example uses this combination for a backup copy. |
/MT:n |
Enables multithreaded copying; the documented range is 1–128 threads and the default is 8. | Choose a value appropriate to the environment. The reference does not promise a speed improvement for every workload. Incompatible with /IPG and /EFSRAW. |
/R:n /W:n |
Sets retry count and wait interval. | Defaults are 1,000,000 retries and 30 seconds between retries, so unattended jobs should normally set intentional values. |
Microsoft also documents /J for unbuffered I/O and recommends it for large files. It does not provide universal throughput figures, so neither multithreading nor a particular I/O option should be treated as a guaranteed performance improvement.
Decide which metadata and files to copy
Robocopy’s default file-copy flags are DAT: data, attributes, and timestamps. If the task also requires security and ownership information, /COPYALL is equivalent to /COPY:DATSOU, adding NTFS ACLs, owner, and auditing information. These choices affect metadata as well as file contents, so use security-related flags only when they match the intended permissions and ownership behavior.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteRank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
D: file dataA: file attributesT: timestampsX: skip alternate data streamsS: NTFS ACLsO: ownerU: auditing information
/DCOPY controls directory information; its documented default is DA. Do not assume file-copy flags also determine which directory metadata is copied.
Filters can narrow which files or directories are considered. For example, /XF excludes file names or paths, /XD excludes directories, /MAX and /MIN set file-size limits, and /MAXAGE and /MINAGE set age filters. /XO excludes source files older than their destination counterpart; /XN excludes source files newer than the destination. Confirm the selection logic against the intended result before running a destructive mirror job.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Copy to a network share and manage free space
A destination can be a quoted UNC path, such as \serversharefolder. Microsoft’s reference demonstrates a network-share copy using /MT and /Z; multithreading can be tuned, while restartable mode can resume an interrupted file copy. The same source/destination checks, retry decisions, and logging practices apply to a share.
/LFSM enables low-free-space mode: Robocopy pauses when a copy would reduce free space on the destination below a floor. The documented default floor is 10% of the destination volume size. /LFSM cannot be combined with /MT or /EFSRAW.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Log the run and interpret the exit code
Microsoft highly recommends creating and inspecting a log to verify a run. /LOG:path writes a log, while /LOG+:path appends to an existing one. For more detail, /V requests verbose output, /TS timestamps, /FP full paths, and /BYTES byte counts.
A positive return code does not automatically mean the copy failed. Microsoft describes codes 0–7 as combinations that do not report a failure; a value of 8 or greater means at least one failure occurred.
| Code | Meaning |
|---|---|
| 0 | No files copied; no failure or mismatch, and the destination already had the files. |
| 1 | All files copied successfully. |
| 2 | Extra files exist in the destination; no files copied. |
| 3 | Some files copied and extra destination files are present; no failure reported. |
| 5 | Some files copied and some mismatched; no failure reported. |
| 6 | Extra and mismatched files; no files copied and no failure reported. |
| 7 | Files copied, with mismatches and extra files. |
| 8 or greater | At least one failure occurred; Microsoft’s example description for code 8 says several files did not copy. |
Use the return code together with the log: inspect failures, mismatches, and extra destination files in light of the job’s purpose. A code below 8 is not a substitute for checking whether the selected copy behavior produced the intended result.
Special case: copying from a device root
When copying from the root of a device, Microsoft notes that the destination directory adopts the hidden and system attributes during the copy process. Take that behavior into account if the destination folder’s attributes matter to other workflows.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchQuick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

