DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
FREEDOM251

Freedom251 › Blog › Backup

How to Use Robocopy to Sync Files and Folders in Windows Safely

By Freedom251 Team · · 12 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Robocopy is Windows’ built-in command-line utility for copying directory trees and keeping a destination aligned with a source. For a normal copy that includes every subfolder, including empty ones, run robocopy "C:Source" "D:Destination" /E. Use /MIR only when the destination must exactly mirror the source, because it deletes destination-only files and folders. Preview any mirror with /L first.

What Robocopy syncs—and what it does not

Robocopy (Robust File Copy) compares a source path with a destination path and copies files that are missing or need updating. You can run the same command again later to copy changes made since the previous run. It works between local Windows folders, drive letters and SMB network shares.

As an Amazon Associate I earn from qualifying purchases.

Robocopy is a one-way synchronizer: the source is authoritative for the operation. A standard copy command adds or updates files at the destination but does not remove unrelated destination files. A mirror command makes the destination resemble the source by purging items that exist only at the destination. It does not provide two-way merging in which changes made independently in both locations are reconciled.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The general syntax is:

robocopy <source> <destination> [<file> [...]] [<options>]

Quote paths whenever they contain spaces. The source and destination should identify the folder levels you actually intend to synchronize. Pointing at a parent folder rather than the intended child folder can copy a much larger tree; with /MIR, a mismatch can also cause broad deletion and recopy operations.

#1 Best Overall
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
  • Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Choose the right synchronization behavior

Goal Command option What happens Main risk or limitation
Copy all subdirectories, including empty folders /E Copies the directory tree and retains empty directories. Destination-only files remain; the destination is not an exact mirror.
Copy non-empty subdirectories only /S Copies subdirectories but excludes empty ones. Empty source folders are not created at the destination.
Make destination match source /MIR Mirrors the tree; Microsoft defines it as equivalent to /E plus /PURGE. Files and folders absent from the source are deleted at the destination.
Inspect a proposed operation /L Lists what Robocopy would do without copying, deleting or time-stamping files. It performs no changes, so you must remove it for the real run.

Use /E when the destination may contain its own material, such as a working folder with extra files. Use /MIR only when deleting destination-only content is an explicit requirement. Never treat /MIR as a harmless synonym for “copy everything.”

Prepare the source and destination safely

Check the paths and permissions

  • Open File Explorer and confirm the exact source folder and destination folder. Check drive letters, share names and spelling.
  • Make sure the account running Robocopy can read the source and write to the destination. A protected folder or share may require an appropriately authorized Command Prompt.
  • Ensure the destination has enough free space for the files and any metadata you intend to copy.
  • If the destination contains irreplaceable files, make a separate backup before testing a mirror. A mirror can remove them when they are not present in the source.

Decide whether empty folders matter

Choose /E if the directory structure itself matters, including empty project, archive or placeholder folders. Choose /S if empty directories are noise and should be omitted. These options affect folders; they do not change the basic file-data copy.

Decide what metadata must survive

Robocopy’s documented default file copy setting is /COPY:DAT: file data, attributes and timestamps. That is suitable for many ordinary folder copies. It does not automatically copy every security-related property. Security descriptors, owner information and auditing data require additional copy flags selected for the migration’s requirements. Copying permissions can also require rights that the running account does not have, so do not add security flags without understanding the source and destination access model.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Copy a folder tree without purging the destination

This is the safest starting pattern when you want the destination updated but do not want unrelated destination-only items removed:

robocopy "C:Source" "D:Destination" /E /R:2 /W:5 /LOG:"C:Logsrobocopy.log"

Replace all three paths with valid locations. The example includes empty directories, retries failed files twice, waits five seconds between retries and writes a log. Create the log directory first if it does not already exist; otherwise choose an existing location.

Run it step by step

  1. Press the Windows key, type Command Prompt, and open it. Use an elevated prompt only when the paths or permissions require administrator rights.
  2. Type the command with the source and destination in quotes. Do not add a trailing wildcard unless you specifically intend to filter the file set.
  3. Press Enter and let the operation finish. Keep the window open while files are being copied.
  4. Open the log named in /LOG: and review the listed files and any failures.
  5. Run the same command again whenever you want to bring the destination up to date. Robocopy will process changes it detects since the prior run.

/LOG:<path> writes output to a new log file at the specified path. Microsoft also documents /LOG+:<path>, which appends output to an existing log instead of replacing it. Use append mode when you want a history of repeated runs, and use a new log when each run should stand alone.

Mirror a destination only after a preview

Mirroring is appropriate for a replica, a staging directory or a destination that must contain no files absent from the source. It is destructive to destination-only content, so separate the preview and execution into two commands.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
  • Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

1. Preview the mirror

robocopy "C:Source" "D:Destination" /MIR /L

Microsoft describes /L as listing files only: they are not copied, deleted or time-stamped. Read the complete output. Look for an unexpected top-level folder, a reversed source and destination, or a large set of deletions.

2. Run the approved mirror

robocopy "C:Source" "D:Destination" /MIR /R:2 /W:5 /LOG:"C:Logsrobocopy-mirror.log"

Remove /L only after the preview matches your intent. Because /MIR includes purge behavior, destination files and folders that are not in the source will be removed. If you discover that the paths are wrong, stop before running the non-preview command. Correct the paths and perform another preview.

Why folder level matters

Suppose the source is C:ProjectsCurrent but you accidentally specify C:Projects. Robocopy then evaluates every folder under Projects, not just Current. In a mirror, the destination is compared with that broader tree; items outside the intended scope may be deleted or recopied. Microsoft’s Azure migration guidance warns that mismatched folder structures can lead to large-scale deletions and recopies. The same path-discipline applies to local drives.

Control retries and waits instead of accepting the defaults

Robocopy retries failed operations. Microsoft documents defaults of 1,000,000 retries and a 30-second wait between retries. Those defaults can keep an interactive command running for a very long time when a file is locked, a drive is disconnected or a network share is unavailable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Option Meaning Example
/R:<n> Number of retries for a failed file operation. /R:2 retries twice.
/W:<n> Seconds to wait between retries. /W:5 waits five seconds.
/LOG:<path> Writes command output to a log file. /LOG:"C:Logsrun.log"
/LOG+:<path> Appends output to an existing log. /LOG+:"C:Logshistory.log"

Small retry and wait values, such as /R:2 /W:5, are practical for an interactive run when you would rather investigate a failure than wait indefinitely. For an unreliable connection, choose larger values deliberately and document the choice in the script or job that runs Robocopy.

Improve throughput or recover interrupted copies

Multithreaded copying with /MT

/MT:<n> enables multithreaded copying. Microsoft documents a supported range of 1 to 128 threads and a default of 8 when multithreading is used. For example:

robocopy "C:Source" "D:Destination" /E /MT:16 /R:2 /W:5

More threads are not automatically faster. Storage speed, network bandwidth, file sizes and server limits determine whether additional concurrency helps. Increase the value carefully and compare completed-run times in your own environment.

Rank #3
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
  • Easily store and access 1TB to content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop. Reformatting may be required for Mac
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Microsoft documents that /MT is incompatible with some options, including /IPG and /EFSRAW. If a command using one of those options fails or is rejected, remove /MT or redesign the command according to the requirement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Restartable mode with /Z

/Z enables restartable mode, which is useful when a copy may be interrupted and later resumed. It is especially relevant to long transfers or connections that can drop. However, Microsoft’s Azure migration guidance cautions that /Z and /ZB can reduce copy performance. Treat restartability as a reliability trade-off, not a universal speed setting.

A context-dependent example is:

robocopy "C:Source" "\ServerShareDestination" /E /Z /R:4 /W:10 /LOG:"C:Logsnetwork-copy.log"

Use restartable mode when recovering from interruptions is more important than maximum throughput. For a stable, fast local copy, test whether omitting it provides better performance.

Copy between SMB shares and Azure Files

Robocopy can operate between SMB file shares by using UNC paths such as \ServerShareFolder. The same source and destination checks apply: verify the share names, confirm write permissions and preview a mirror before allowing purges.

Microsoft provides an Azure Files share-copy example and notes that the same command can be run again to copy changes made since the previous run. Treat that as an advanced network workflow rather than assuming every cloud-storage service behaves identically. Azure Files and other SMB endpoints may have their own authentication, throttling and permission requirements.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Metadata, permissions and security choices

Start with the default data, attribute and timestamp behavior when the goal is ordinary file synchronization. If the destination must preserve Windows security descriptors, owners or auditing information, select the additional copy flags that correspond to those properties and verify that the account has the necessary rights.

  • Data: the file contents.
  • Attributes: flags such as read-only or hidden state.
  • Timestamps: recorded file times used to retain file history.
  • Security: access-control information, which is separate from ordinary data copying.
  • Owner and auditing details: additional metadata that may require elevated rights and deliberate migration planning.

Do not assume that a successful data copy also reproduces access permissions. Test a representative folder with the intended account before applying security-focused options to a large tree.

Rank #4
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
  • Easily store and access 4TB of content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Plan hardware and storage

Robocopy is included with Windows, so syncing does not require a separate Robocopy purchase, subscription or particular brand of drive. A second internal drive, an external hard drive or an SMB share can serve as the destination when it is accessible to Windows and has enough capacity. Microsoft examples use a D: drive as a destination, but the drive letter is only an example, not a requirement.

For an external destination, connect it before starting, verify its assigned drive letter and avoid disconnecting it during the copy. For a network destination, confirm that the share is reachable from the same Windows account that launches Robocopy. Hardware capacity, connection stability and permissions matter more than the brand of the storage device. Keep an independent backup for important files; a mirror is a synchronization operation, not a guarantee against accidental deletion or source corruption.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common mistakes and how to correct them

Destination files disappeared

The command probably used /MIR, which purges destination-only items. Restore from a separate backup if the files are needed. For future non-destructive updates, use /E instead and reserve /MIR for destinations whose contents may be deleted.

Empty folders are missing

You used /S or omitted a recursive option. Use /E to include empty directories.

The command appears stuck

A failed operation may be waiting on Robocopy’s documented default of 1,000,000 retries with 30 seconds between attempts. Cancel the run when appropriate and restart with explicit values such as /R:2 /W:5. Check whether a file is open, a drive is disconnected or a share is unreachable.

The preview shows an unexpectedly large operation

Do not remove /L. Recheck both paths, especially their top-level folder names and drive letters. A source or destination at the wrong level can expand the comparison dramatically. Correct the command and preview again.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Network copying is slower than expected

Test whether multithreading helps, using a measured value such as /MT:8 or /MT:16. Conversely, /Z and /ZB may reduce performance; use them only when their recovery behavior is worth the cost. Also check network bandwidth, server load and the number of small files.

Best Value
UnionSine 500GB Ultra Slim Portable External Hard Drive HDD-USB 3.0 | for PC, Mac, Laptop, PS4, Xbox one, Xbox 360-(Black)
  • [Upgraded Version] - This external hard drive features a mirrored logo stripe combined with a striped anti-slip design, and the rounded corners of the casing make it easier to grip. The stripes also have a heat dissipation function, ensuring stable and fast data transfer.
  • 【Ultra-thin and quiet】 - The motherboard adopts JMicron 578 noise-free solution, giving you a quiet working environment. Lightweight and portable size designed to fit in your pocket for easy portability.
  • 【Ultra-Fast Data Transfers】 - Pairing this external hard drive with JMicron 578 solution USB 3.0 and USB 2.0 interfaces enables blazing-fast data transfer. It boasts theoretical read speeds of up to 125MB/s and write speeds of up to 103MB/s.
  • 【Plug and Play】 - With no software to install, just plug it in and the drive is ready to use.The hard disk chip is wrapped with an aluminum anti-interference layer to increase heat dissipation and protect data.
  • 【What You Get】 - 1 x Portable Hard Drive, 1 x USB 3.0 Cable, 1 x User Manual, Gift-type shell packaging ,Three-year manufacturer's warranty and free technical support services.

Permissions did not come across

/COPY:DAT does not include all security, owner and auditing information. Determine which metadata is required, choose the corresponding copy flags and run with an account authorized to read and set that information. Validate access on the destination instead of judging success solely by the number of copied files.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Reusable command patterns

Use case Command Important behavior
Non-destructive tree copy robocopy "C:Source" "D:Destination" /E /R:2 /W:5 Includes empty folders and keeps destination-only items.
Non-destructive copy with a log robocopy "C:Source" "D:Destination" /E /R:2 /W:5 /LOG:"C:Logsrobocopy.log" Records output in the specified log file.
Mirror preview robocopy "C:Source" "D:Destination" /MIR /L Shows proposed copies and purges without changing files.
Approved mirror robocopy "C:Source" "D:Destination" /MIR /R:2 /W:5 Deletes destination-only files and folders.
Multithreaded tree copy robocopy "C:Source" "D:Destination" /E /MT:16 Uses 16 copy threads; test whether concurrency benefits your storage or network.
Restartable network copy robocopy "C:Source" "\ServerShareDestination" /E /Z /R:4 /W:10 Can resume interrupted transfers, with possible performance reduction.

Pre-run checklist

  • Confirm the source and destination paths and folder levels.
  • Choose /E or /S based on whether empty folders belong in the destination.
  • Use /MIR only when destination-only deletion is intended.
  • Run /MIR /L and inspect the complete listing before a destructive mirror.
  • Set explicit /R: and /W: values instead of relying on million-retry defaults.
  • Decide whether the default /COPY:DAT metadata is sufficient.
  • Add logging with /LOG: or /LOG+: when you need an audit trail.
  • Choose /MT or /Z for a measured performance or recovery need, not by default.
  • Confirm the destination has adequate free space and that any external drive or network share will remain connected.
  • Keep a separate backup when the source or destination contains irreplaceable material.

Frequently Asked Questions

Is Robocopy a two-way sync tool?

No. Robocopy performs a one-way operation in which the source is authoritative. A normal /E copy adds or updates destination files and leaves unrelated destination-only items in place. /MIR makes the destination match the source by purging items absent from the source; it does not merge independent edits made in both locations.

What is the safest Robocopy command for a first run?

Use a non-purging tree copy such as robocopy "C:Source" "D:Destination" /E /R:2 /W:5. It includes empty folders, limits retries and waits, and leaves destination-only files alone. Add a log path after creating its parent directory if you need a record of the operation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How can I know what a mirror will delete?

Run robocopy "C:Source" "D:Destination" /MIR /L first. The /L option lists the proposed work without copying, deleting or time-stamping files. Inspect the complete listing, verify both folder levels and remove /L only after every proposed purge is intentional.

Why did Robocopy seem to hang after an error?

The documented defaults are 1,000,000 retries and a 30-second wait between retries. A locked file, disconnected drive or unavailable share can therefore keep a command running for a long time. Stop it when appropriate and rerun with explicit values such as /R:2 /W:5, then investigate the underlying failure.

Will Robocopy copy Windows permissions?

The documented default /COPY:DAT copies data, attributes and timestamps, not every security property. Security descriptors, owner information and auditing details require additional copy flags and an account with the necessary rights. Test a representative folder and verify access on the destination before migrating a large tree.

Can I use Robocopy with a network or Azure Files share?

Yes. Use UNC paths such as \ServerShareFolder, confirm authentication and write permissions, and choose retry and restart settings for the connection. Microsoft’s Azure Files example can be run again to copy changes made since the previous run, but cloud SMB endpoints may have their own throttling and permission behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do I need to buy special hardware or software?

No separate Robocopy software or license is required because it is built into Windows. A second internal or external drive can be a destination, as can an SMB share, provided it has enough capacity and remains available throughout the run. The specific drive brand is not part of the command’s requirements.

The Bottom Line

Start with /E for a one-way copy that preserves empty folders without deleting destination-only files. Set explicit retry and wait values, log important runs and use /COPY:DAT unless your migration requires additional security metadata. If the destination must exactly match the source, preview /MIR with /L, verify both paths and review every proposed deletion before running the mirror. Treat /MT and /Z as measured choices for throughput or recovery, not automatic improvements.

Quick Recap

Bestseller No. 1
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$129.99
Bestseller No. 2
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$219.99
Bestseller No. 3
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$119.80
Bestseller No. 4
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$189.99

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.

BackupCommand Linefile synchronizationROBOCOPYWindows

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.