The basic syntax of the Robocopy command is as follows:
robocopy [source] [destination] [(file)( ...)] [(options)]
Here are some helpful options you can use with the robocopy command:
☞ Copy options
▪ /s: copy subdirectories except empty directories.
▪ /e: copy subdirectories including empty directories.
▪ /z: The `/Z` option in Robocopy allows you to copy files in restartable mode. This is useful for large file transfers that may be interrupted due to network issues or other reasons.
▪ /purge: The `/MIR` option in Robocopy allows you to mirror a source directory to a destination directory. This means that Robocopy will delete any files or directories in the destination that no longer exist in the source, while also copying any new or updated files from the source to the destination.
▪ /mir: The `/MIR` option in Robocopy allows you to mirror a source directory to a destination directory. This means that Robocopy will delete any files or directories in the destination that no longer exist in the source, while also copying any new or updated files from the source to the destination.
▪ /mt[:n]: The `/MT` option in Robocopy allows you to create multi-threaded copies with a specified number of threads. This can significantly improve the performance of the copy operation, especially for large files or directories.
☞ File selection options
▪ /xd [directory][ ...]: exclude directories that match the specified names and paths.
▪ /xn: The `/XO` option in Robocopy allows you to exclude files in the source that are newer than the corresponding files in the destination. This can be useful when you want to copy files from the source to the destination, but only if the files in the source are older than or identical to the files in the destination.
▪ /xo: exclude older files. It is opposite to /xn.
▪ /maxage:[n]: The `/MAXAGE` option in Robocopy allows you to specify the maximum file age, excluding files older than the specified number of days or date. This can be useful when you want to copy files from the source to the destination, but only if the files are within a certain age range.
▪ /minage:[n]: The `/MINAGE` option in Robocopy allows you to specify the minimum file age, excluding files newer than the specified number of days or date. This can be useful when you want to copy files from the source to the destination, but only if the files are within a certain age range.
▪ Learn more >>
To perform two-way file synchronization using Robocopy, you can use the following command lines in a Command Prompt window:
1. Search for Notepad from the search box in the taskbar, and click the top result to start the app.
2. Type the following lines to create a batch file:
3. Press Ctrl + S to save the batch file. Name the file with the ".bat" extension, "robocopy_sync.bat" for example. Put the file in a location you can easily find.
4. Double click the "robocopy_sync.bat" file to sync files and folders between two specified locations. It will bring out a Command Prompt window to show you the sync result. Press any key to close the window.
✍ Tips:
◈ To edit the batch file, right click it and select Edit.
◈ If you encounter Robocopy error 5 (0x00000005) access denined, try to log in your computer as administrator. Then right click on the batch file and select Run as administrator.
While Robocopy is a powerful command-line utility for file synchronization, it has some limitations that you should be aware of:
Robocopy, a popular file synchronization tool, has some limitations when used on systems older than Windows Vista. Fortunately, there are alternative tools that can help overcome these limitations.
Qiling Disk Master Professional is a top-notch file sync software that offers a wide range of features to help you manage your files efficiently. Here are some of its key sync features:
Step 1. Download, install, and launch Qiling Disk Master. At the main interface, click Sync and select Two-Way Sync.
Step 2. Edit the task name so that it can be easily identified. Click Folder to select the folder you want to sync.
✍ Tips: Qiling Disk Master Professional is a cutting-edge file sync software that simplifies the process of synchronizing files across various devices and storage locations. This powerful tool allows you to sync files from one folder, disk, or computer to another, making it an ideal solution for managing your digital files efficiently.
Step 3. Click the second bar to choose another folder as the destination folder.
Step 4. (Optional) To run two-way sync automatically, you can click Schedule Sync in the bottom and choose a proper frequency in the Schedule Settings window.
Step 5. Confirm the source and destination directory and click Proceed. Any changed files will be synced from the source to the destination as well as the other way around.
★ Bonus tip: backup files to Qiling Cloud
As cloud storage is becoming more and more popular, Qiling offers users its own cloud - Qiling Cloud. If you create an Qiling account, you can backup files to Qiling Cloud. It offers you 1TB free storage for 15 days after you sign up for an Qiling account.
You have learned how to run Robocopy two-way sync for folders in Windows 11/10/8/7. However, Robocopy may disappoint you when it comes to copying open files and running auto copy. Qiling Disk Master can help you out under these circumstances.
What’s more, it offers backup, restore and clone features. You are able to backup a hard drive to cloud and clone a hard drive via Command Prompt using Qiling Disk Master. Try it now by yourself!