Robocopy (Robust File Copy) is a command that is used to copy directories and files from one location to another. It has been a built-in feature since Windows Vista and Windows Server 2008. The basic syntax of the robocopy command is as follows:
robocopy [source] [destination] [(file)( ...)] [(options)]
There are various options you can use with the robocopy command to meet different needs. Here I’d like to list some helpful options:
☞ Copy options
☞ File selection options
How to run two-way sync with Robocopy step by step
To run Robocopy two-way synchronization, you can type the corresponding command lines in a Command Prompt window directly. However, if you want to perform two-way file sync on a regular basis, it is suggested to create a bat file to run the robocopy command. Thus, you don’t need to retype the same command every time. Follow the steps below to run two-way sync with Robocopy:
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:
echo Syncing from C drive to E drive
robocopy "C:\Users\AOMEI Technology\Documents" "E:\synced files" /e /z (As there are spaces in the directory names, I add quotation marks around the source and destination path.)
echo Syncing from E drive to C drive
robocopy "E:\synced files" "C:\Users\AOMEI Technology\Documents" /e /z
echo Sync Complete
pause (It prevents the console window from closing after executing the command.)
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.
◈ 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.
Now you know how to perform Robocopy two-way sync. Although the whole process seems not complicated, there are some limitations of Robocopy you should know:
It does not copy open files.
It does not mirror properly on systems older than Windows Vista. It ignores changed security attributes of previously mirrored files.
It can’t sync files automatically unless you use Task Scheduler.
Luckily, there is a powerful file sync tool which makes up the flaws of Robocopy. Read on to get it.
Easier way to perform two-way sync in Windows
AOMEI Backupper Professional is superb file sync software designed for Windows 11/10/8.1/8/7/Vista/XP, 32 bit and 64 bit. Let’s have a close look at its sync features:
Versatile sync modes: it offers Basic Sync, Mirror Sync, Real-Time Sync, and Two-Way Sync. You can choose one mode that best meets your need.
Abundant sync locations: it enables you to sync files from one folder/disk/computer to another one. You are also allowed to sync two external hard drives and sync local folders to OneDrive, Google Drives, etc.
Auto sync: it is embedded with the “Schedule” feature that can help you sync files at fixed intervals.
Background sync: it is able to copy open or running files. You don’t need to close other running applications to launch the sync process.
How to perform two-way sync via AOMEI Backupper?
Step 1. Download, install, and launch AOMEI Backupper. 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 Add Folder to select the folder you want to sync.
✍ Tips: You are only allowed to choose one source folder in one task when performing Two-Way Sync. You can sync multiple folders at once if you choose the other three sync modes.
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 in the bottom and choose a proper frequency in the Schedule Settings window.
Step 5. Confirm the source and destination directory and click Start Sync. Any changed files will be synced from the source to the destination as well as the other way around.
To sum up
You have learned how to run Robocopy two-way sync for folders in Windows 10/8/7. However, Robocopy may disappoint you when it comes to copying open files and running auto copy. AOMEI Backupper can help you out under these circumstances.
What’s more, it offers backup, restore and clone features. You are able to clone a hard drive via Command Prompt using AOMEI Backupper. Try it now by yourself!