Sync Two Folders with Robocopy Command Line in Windows  

Sync Two Folders with Robocopy Command Line in Windows


Table of Contents
  1. User Case: How Do I Sync Two Folders with Robocopy?
  2. Robocopy Command Line Syntax and Options
  3. How to Perform Robocopy One-Way Sync Two Folders
    1. Situation 1: Robocopy Sync Two Shared Folders
    2. Situation 2: Robocopy Incremental Sync
    3. Situation 3: Robocopy Real Time Sync Two Folders
    4. Other Robocopy Sync Situations
  4. Windows Sync Two Folders Command Line Limitation
  5. Easier Way to Sync Two Folders in Windows
  6. The Epilogue

User Case: How Do I Sync Two Folders with Robocopy?

"Hi, we have two shared folders. One is primary which is shared with the user and almost about to fill and the other is not shared yet but I want to sync all the data from primary to new one with Robocopy command line.

The problem is how do I sync two folders with Robocopy? I don't want to sync current files already in the new folder, only changes in the primary folder to new folder. Thanks."

Windows Sync Two Folders with Robocopy Command Line

Sometimes, you may need to  sync two folders located in different computers or other locations, such as, internal or external drives, to make the two folders keep the same content. Here we will show you different ways to perform Windows sync two folders with command line tool.

Robocopy Command Line Syntax and Options

Robocopy is a robust file copy command for Windows PCs and it allows you to copy files, directories, and even drives from one location to another. It provides you with different parameters to sync two folders in Windows 11/10/8/7.

👉 Robocopy command line syntax: You can specify the path to source and destination directory, files or folders you want to sync and other options. 

robocopy [Source] [Destination] [(File)( ...)] [(Options)]

Source It specifies path to source directory, type as, drive:\path or \\server\share\path.
Destination It specifies path to destination directory,  type as, drive:\path or \\server\share\path.
File It specifies files you want to copy, type as, names/wildcards: default is "*.*".
Options It specifies copy, file, retrt, logging, and job options to use with robocopy command.

👉 Common used options in Robocopy: 

👉 To know more parameters you could use, please input robocopy /? to get more details.

Robocopy Commands

How to Perform Robocopy One-Way Sync Two Folders 

In general, Robocopy is a one way file sync solution, and you can sync files easily from one location to another  as long as you use the right options. And I will introduce you to the most common cases below. Note that you need to run cmd as administrator in all the following situations. 

Situation 1: Robocopy Sync Two Shared Folders 

The first case is to sync two folders on different computer through shared folder. For example, to sync tmp folder(and its subfolders) located in \\192.168.0.250\PublicShare\ to \\192.168.0.58\WorkD, please input the following command line:

robocopy \\192.168.0.250\PublicShare\temp \\192.168.0.58\WorkD /e /copy:DAT /mt /z

Robocopy Sync Two Folders  

Notes:

Situation 2: Robocopy Incremental Sync

Except for simply sync two shared folers, you still can create incremental sync task with Robocopy command line. You will use the /xo or /xc option, which has the ability to let Robocopy sync changes only to the destination folder.

For example, to sync changed part from source \\192.168.0.250\PublicShare\temp to \\192.168.0.58\WorkD in restart mode and creates multi-threaded copies with 8 threads, input the following command line:

robocopy \\192.168.0.250\PublicShare\temp \\192.168.0.58\WorkD /e /copy:DAT /mt /z /xc /xn /xo

Robocopy Incremental Sync

Notes:

Situation 3: Robocopy Real Time Sync Two Folders

Besides, Robocopy still offers you /mot:  to monitor changes in M minutes (only accept minutes as argument). Note the changes less than one minutes will not be included.

For example, monitor every one minutes based on the above command, type the following command:

robocopy \\192.168.0.250\PublicShare\temp \\192.168.0.58\WorkD /e /copy:DAT /mt /z /xc /xn /xo /mot:1

Robocopy Real Time Sync Two Folders

Note:

Other Robocopy Sync Situations

Except for the above cases, you still can use batch files and  Windows Task Scheduler to continuously copy all file changes.

Besides, you could specify the mirror sync task with the /purge parameter, it will delete destination files and directories that no longer exist in the source. 

For two-way sync, you need to create a batch file with Notepad. For detailed steps, please refer to Robocopy two-way sync

Windows Sync Two Folders Command Line Limitation

Robocopy is good assistant to helps you perform one way, but there are some restrictions using Robocopy sync two folders:

Easier Way to Sync Two Folders in Windows 

Except for the Robocopy command line, you still can try GUI-based file synchronization software - Qiling Disk Master Professional. It supports Windows XP, Vista, 7, 8, 8.1,10 and 11(32-bit and 64-bit) and helps you sync two folders easily with the following options.

Basic Sync: It will sync files from one location to another and supports daily, weekly, monthly, event trigger and USB plug in schedule sync settings.
Real-Time Sync: It will monitor and sync changes imediately once it's detected, thus maximizing the retention of changes. 
Mirror Sync: It is a one-way file sync method and more concerned about files in the destination, any change will be undo, and you cannot add new files to it, or delete files already in it. 
Two-Way Sync: Unlike previous 3 methods, it will sync files between source and destination directory. All the schedule sync settings are supported.

Besides, it still allows you to sync two folders to multiple destinations, such as local disk, external hard drive (HDD or SSD), CD/DVD, USB flash drive, network share or NAS, even to cloud drives like Google Drive, Dropbox, OneDrive, Box, etc.

To get started, please download Qiling Disk Master Professional and install it on a Windows PC. For server users, try Qiling Disk Master Server!

Step 1. launch Qiling Disk Master Professional on your Windows 10 computer, select Backup and recovery tab and then a method to sync two folders, here take File Sync as an example.

Real Time Folder Sync

Step 2. Press Folder or Share/NAS device.

Add Shared Folder

Step 3. Click Add NAS Devices and then input the display name and network path to add the network share, and choose the folders you want to sync. You still need to type username and password if you receive error while adding network path. 

Add Network Path

Step 4. Hit Proceed to sync two folders in real time in Windows. Optionally, you can click Options to comment the real time folder sync task, email or SMS notification, and verify the integrity of the files in the destination location during synchronization, etc.

Proceed Shared Folder To Another Shared Folder

After the first full folder sync, then any changes made on the source folder will be synced to the destination immediately. It's the safest way to protect files, and meanwhile, it will take up the most disk space compared to other sync methods. 

Of course, if you mind the disk space issue, you can also use other sync methods (eg: Mirror Sync) to sync files with daily, weekly, or monthly frequency, or based on event triggers, USB plug in. This can alleviate the disk space problem to some extent. 

Sync Automatically

To completely resolve this issue, you could consider using the Backup feature to duplicate files. It not only schedules backup files but also deletes old backup images automatically to free up disk space. You have 3 options in following:

Scheme

Besides, you still can choose to backup folders to Qiling Cloud, a cloud drive with 1TB of free storage, and you have 15 days of free access to it after registration. And it enables you to run this task automatically, such as, daily, weekly, or monthly. 

The Epilogue

Compared with Windows sync two folders via command line tool - Robocopy, the best file sync software - Qiling Disk Master Professional provides you flexible ways to sync two folders in Windows 11, 10, 8, and 7. You can choose different sync methods and schedule settings based on your needs.

In addition, it still a professional backup software. If you don't want the files occupying much disk space, try the File Backup feature. And then, you can enable schedule backup, incremental or differential backup and automatic backup cleanup to manage backup task and disk space flexibly.

Related Articles


Is this information helpful?     

What can we do to improve this information? (Optional)
Refresh Please enter the verification code!