How to Sync Two Folders with Robocopy Command Line in Windows

Learning to Windows sync two folders command line via Robocopy is essential. It allows you to transfer files from one location to the other seamlessly. This post details how you can use the Robocopy command to sync files in Windows. Keep reading.

Page Table of Contents

Larissa

Updated on Jul 24, 2024

0 Views | 0 min read

Syncing files between two folders ensures you maintain their exact copies between the two locations. Do you know how to Windows sync two folders command line? This post will outline how you can use the Robocopy command to sync files between folders on Windows. You may want to sync files to create backups or for sharing purposes. 

An Overview of Windows Robocopy Command Line

Robocopy is a CMD command used on Windows to move (copy) drives, folders/files, or directories across different locations on your PC. It allows you to maintain exact copies of data in multiple locations. Robocopy is essential for file synchronization and backup.

You can also use it for data migration, where you permanently move files from one location to another. Below is a general syntax for Robocopy:

robocopy [source] [destination] [(file)(...)] [(options)]

The term "file" represents the actual name of the file you want to copy, while "options" refers to the different Robocopy operations like logging, copying, etc. Some of the copy command options that you can use with Robocopy include:

  • /z- allows the system to copy files in restartable mode.
  • /b- allows the system to copy files in backup mode.
  • /e- It copies all subdirectories, including the empty ones.
  • /s- copies all subdirectories but not the empty ones.
  • /zb- copies files in either restartable or backup modes. The system will use the latter when denied in the former.
  • /copyall- copies every file detail from source to destination. This includes DAT (data, attributes, and time stamps). 
  • /efsraw- allows you to copy all encrypted files in EFS RAW format.
  • /mt[:n] lets you create multi-threaded copies for up to "n" threads. The "n" could be a number from 1-128.

When moving files across different locations, you can use these common parameters alongside the Robocopy command. The next section will outline how you can apply them.

📚Related reading: Robocopy Command to Copy Folders and Subfolders | Robocopy Sync Folders One Way

How to Sync Two Folders with Windows Robocopy Command

A Robocopy sync ensures that files on the destination folder have attributes, data, and time stamps similar to those on the source. Any changes made to files in the source will reflect directly to those in the destination folder.

This section will describe cases where you can sync two folders on a PC using Robocopy. Ensure you launch Command Prompt as an administrator.

Case 1. Robocopy Sync Two Folders on PC

The first case allows you to specify the source and destination folders through their paths. You can then give the specific files or subfolders you want to move. Robocopy will ensure you have an exact copy of files from your source folder in the destination. Check the following example:

robocopy "C:\Users\Public\Documents\New Documents" "E:\MyBackups2" /e /copy:DAT /mt /z

robocopy files

The above command has copied files under the "New Documents" folder to the "MyBackups2" folder, including their empty directories in restartable mode. Below is a breakdown of what the command options do:

  • /copy: DAT- copies all data, attributes, and time stamps to the destination folder. It allows you to modify the copied files.
  • /mt- allows you to create multi-threaded copies consisting of 8 threads.

That's how to sync files between two folders with Robocopy.

Case 2. Robocopy Incremental Sync

This case applies when you've added new files in the source folder. You'll need to run the Robocopy incremental sync command and copy the new files to the destination folder. This command allows you to only sync the new files and exclude the old ones. Check below:

robocopy "C:\Users\Public\Documents\New Documents" "E:\MyBackups2" /e /copy:DAT /mt /z /xc /xn /xo

robocopy files

The above Robocopy command will sync any changes made in the "New Documents" folder to the "MyBackups2" folder. Here's a breakdown of what the command options do:

  • /xo- it excludes older files.
  • /xc- it excludes changed files of the same timestamp but varying sizes.
  • /xn- it excludes files that are newer than the copy in the source folder.
  • /mt- this option enables multi-threaded copying with 8 as the default number of threads.

That's how to perform incremental sync using Robocopy.

Case 3. Robocopy Real Time Sync Two Folders

This scenario allows Robocopy to monitor and implement real-time changes between the folders. It checks any changes made on the source folder and syncs them to the destination folder. This is made possible using the "/mot" command option.

It allows you to specify the number of "N" minutes you want the changes monitored. The number should be at least one minute. Below is an example.

Before changes:

robocopy files

After changes:

robocopy files

Is the post useful? Share it on your social platforms and help others sync folders with the Windows Robocooy command line.

 

Easier Way to Sync Folders on Windows with Free Syncware

Robocopy is an effective tool for copying files on Windows. However, it comes with the following limitations:

  • The commands used may prove complicated to novice computer users.
  • You may lose important data if you enter the wrong parameters.
  • You can't copy open files with Robocopy.
  • Robocopy has mirroring issues in operating systems older than Windows Vista.

Which is an easier option to sync folders on Windows? You should try out EaseUS Todo Backup. This tool has a unique sync feature that seamlessly moves files from source to destination. You just need to specify the drive path, and Todo Backup will do the magic for you. It allows you to sync files between computers in just a few clicks.

You can even sync open files. The tool allows you to select different sync destinations, including those on another PC or external hard drive. You can schedule an automatic sync that could happen daily, weekly, or monthly. This tool allows you to filter files and only sync the file types you want during the sync process. What more? The tool provides the ultimate backup and restore solution for all your PC data.

Key Features

  • Sync files from one folder to another on Windows.
  • Real-time file syncing.
  • Perform scheduled syncing like daily, weekly, or monthly.
  • It allows you to filter the files to sync.
  • Supports file backup and restore.
  • It provides free cloud storage of no more than 250GB.

Download this tool now to use it as a Robocopy alternative. The steps for getting started are very simple.

step 1. Launch EaseUS Todo Backup and click New Sync button in the bottom-left corner.

click sync button

Step 2. Click Select sync path from the left side.

select sync path

Step 3. Choose a folder that your want to sync, and click OK. The source folde can be from Desktop, My Documnets, Favorites, Computer, Network, or NAS.

select a folder

Step 4. Select a target location where you want to sync files to. You can choose Two-way sync or One-way sync method according to your needs.

choose a sync location

Bonus: Tap Options button to select a sync scheme, which can schedule a sync task on daily, weekly, upon an event, or real-time sync.

sync scheme

Step 5. Click Sync Now to start a sync task right now.

start sync now

Step 6. Wait for the sync process to finish, you can see a File Sync column in the top-left corner.

compltete sync task

Is the post useful? Share it on your social platforms and help others sync folders with the Windows Robocooy command line.

 

Sum Up

This post discusses how to sync two folders with the Windows command line. Robocopy is an effective tool for syncing files and subfolders across different locations on your PC. Ensure you launch CMD as an administrator when using this command-line utility. Despite its effectiveness, Robocopy has some limitations.

Try out EaseUS Todo Backup if you want to seamlessly sync files between folders on Windows. This tool has an intuitive interface that makes it easy to use. You won't lose your files during the copy process like with Robocopy. Download this tool now to check how it works.

FAQs about Windows Sync Two Folders with Command Line

1. What is the easiest way to synchronize files and folders between your computer and OneDrive?

You should install OneDrive on your computer and sign in to your account. Next, you can open the OneDrive folder and select the files you wish to sync to the cloud. OneDrive will automatically sync the files and folders to the cloud (your device should have an internet connection).

2. How to sync folders between computers?

You can do this by connecting the two devices to a shared network. You can then use a third-party tool like EaseUS Todo Backup to sync files between the folders. This tool has a sync feature that allows you to specify the source and destination path before you initiate the transfer. You can sync files via a network or NAS.

3. Can OneDrive sync other folders?

YES. Launch the OneDrive app, then go to Settings>Account>Choose folders and select the other folders on your PC that you want synced to the cloud. Click OK to implement the changes. OneDrive will then sync the selected folders to your cloud account.

EaseUS Todo Backup

EaseUS Todo Backup is a dependable and professional data backup solution capable of backing up files, folders, drives, APP data and creating a system image. It also makes it easy to clone HDD/SSD, transfer the system to different hardware, and create bootable WinPE bootable disks.

  • Updated by

    Larissa

    Larissa has rich experience in writing technical articles and is now a professional editor at EaseUS. She is good at writing articles about data recovery, disk cloning, disk partitioning, data backup, and other related knowledge. Her detailed and ultimate guides help users find effective solutions to their problems. She is fond of traveling, reading, and riding in her spare time.…
    Read full bio

EaseUS Todo Backup

Smart backup tool for your files, disks, APPs and entire computer.

  Try It Now

Support Windows 11/10/8/7