"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."
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 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.
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.
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
Notes:
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
Notes:
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
Note:
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.
Robocopy is good assistant to helps you perform one way, but there are some restrictions using Robocopy sync two folders:
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.
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.
Step 2. Press Folder or Share/NAS device.
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.
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.
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.
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:
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.
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.