Keeping two folders in sync automatically means changes in one folder (new files, edits, deletions) are mirrored to the other without you copying anything manually. This is useful for backing up to an external drive, keeping a laptop and desktop in step, or maintaining a second copy for safety. Before you start, decide which folder is the “source” (the one you edit) and which is the “destination” (the mirror), and make sure both folders are accessible from the same Windows user account.
What You’ll Need
- Windows 10 or Windows 11 (the built-in tools work on both)
- Two folders you want to keep in sync (they can be on the same drive, different drives, or a network share)
- For the Robocopy method: a text editor like Notepad and the Task Scheduler (both built into Windows)
- For the third-party method: an internet connection to download a free sync tool (like FreeFileSync or SyncToy)
- Optional: an external drive or network location if you want an off-site copy
Step-by-Step
There are several ways to automate folder syncing in Windows. Choose the one that fits your comfort level.
Method 1: Use Robocopy with Task Scheduler (Built-in, No extra software)
- Open Notepad (press Win + R, type
notepad, press Enter). - Write the Robocopy command. The basic syntax is:
robocopy "C:\SourceFolder" "D:\DestinationFolder" /MIR
The/MIRflag mirrors the source to the destination, meaning it deletes files in the destination that no longer exist in the source. If you don’t want deletions, use/Einstead (copies subdirectories, including empty ones, but doesn’t delete). - Add the
/LOGflag to keep a record of what was copied (optional but helpful):robocopy "C:\Source" "D:\Dest" /MIR /LOG:"C:\SyncLog.txt" - Save the file with a
.batextension, for examplesyncfolders.bat. In Notepad, choose “Save As”, set “Save as type” to “All Files”, and name it with the .bat ending. - Test the batch file by double-clicking it. Check that the destination folder now matches the source.
- Open Task Scheduler: press Win + R, type
taskschd.msc, press Enter. - Create a new task: In the right-hand pane, click “Create Basic Task…”.
- Name the task (e.g., “Folder Sync”) and click Next.
- Choose the trigger: For example, “Daily” or “When I log on”. Click Next and set the time you want the sync to run.
- Choose the action: Select “Start a program”, then click Next.
- Browse to your .bat file in the “Program/script” field. Click Next and then Finish.
- Run the task manually to confirm it works: right-click the task in Task Scheduler and select “Run”.
Method 2: Use a Free Third-Party Sync Tool (Easier, More Features)
- Download a free sync tool like FreeFileSync or SyncToy (from Microsoft). These are reputable and have been around for years.
- Install the tool and launch it.
- Set the source and destination folders in the two main panels. The left is the source, the right is the destination.
- Choose the sync mode: “Mirror” (makes the right match the left, deleting extras) or “Two-way” (keeps both in sync, so changes on either side propagate to the other).
- Run a test sync by clicking the “Compare” button first, then “Synchronize”. Review the list of files that will be changed.
- Set up automatic syncing: Most tools have a built-in scheduler. For FreeFileSync, use the “Batch job” feature (File > Save as batch job) and then schedule it with Task Scheduler, or use the tool’s own “RealTimeSync” utility.
- For SyncToy: After creating a folder pair, you can use the “SyncToy” task in Task Scheduler (it appears after you install it).
Method 3: Use OneDrive or Another Cloud Service (For Cloud Sync)
- Install OneDrive (it’s built into Windows 10/11) and sign in.
- Move or copy your folder into the OneDrive folder (usually
C:\Users\YourName\OneDrive). - On your other device, sign in to the same OneDrive account and the folder will sync automatically.
- To sync with a non-cloud folder, you can use the “Backup” feature in OneDrive settings to sync known folders (Desktop, Documents, Pictures) automatically.
Common Mistakes
- Using /MIR when you don’t want deletions: If the destination has files you want to keep but aren’t in the source, /MIR will delete them. Double-check the flags.
- Not escaping spaces in paths: In the batch file, always put quotes around paths with spaces, as shown in the examples.
- Running the sync in the wrong direction: If you accidentally swap source and destination, you’ll overwrite your good files with older ones.
- Forgetting to test the scheduled task: A task may fail silently if the path to the .bat file is wrong or if the user account doesn’t have permission.
- Syncing to a network drive that isn’t connected: Robocopy will fail if the network location is unavailable. Set the task to run only when the drive is present, or use a tool that can wait for the drive.
Tips
- Use the /MIR flag with caution: It’s great for exact mirrors, but if you accidentally delete files in the source, the next sync will delete them in the destination too. Consider using /E if you want a one-way copy without deletions.
- Add a log file: Robocopy’s /LOG flag creates a record you can check if something goes wrong.
- Schedule at a time when the computer is on: If your PC is off at the scheduled time, the task won’t run. Use “Run task as soon as possible after a scheduled start is missed” in Task Scheduler settings.
- For real-time syncing: Use a tool like FreeFileSync’s RealTimeSync, which watches the folder and syncs whenever a change is detected.
- Keep the source and destination on the same drive for speed: If they’re on the same physical drive, copying is faster than across drives.
- Test with a small folder first: Before syncing your entire Documents folder, try with a test folder to make sure the behavior is what you expect.
Troubleshooting
- The scheduled task doesn’t run: Check the task’s “History” tab in Task Scheduler. If it shows an error, right-click the task and select “Run” to see the error message. Common issues: the .bat file path is wrong, or the user account doesn’t have permission to access the folders.
- Robocopy says “Access Denied”: Run the batch file as Administrator (right-click the .bat and select “Run as administrator”). If that works, in Task Scheduler, check “Run with highest privileges” in the task’s properties.
- Files are not syncing in the right direction: Re-read your Robocopy command. The first path is the source, the second is the destination. If you’re using a GUI tool, check the arrows or labels.
- Syncing to an external drive fails when the drive is unplugged: The task will error. You can create a separate task that runs when the drive is connected, or use a tool that can wait for the drive (like FreeFileSync’s “Wait for” option).
- The sync is very slow: If you have many files, the first sync can take a long time. After that, it should be faster. If it’s still slow, check if your antivirus is scanning every file change; you can add an exclusion for the sync folders.
- Deleted files reappear: This happens if you’re using a two-way sync and the deletion hasn’t propagated. In Robocopy, if you use /MIR, deletions should propagate. In GUI tools, make sure you’re not accidentally in “Two-way” mode when you want “Mirror”.
Frequently Asked Questions
Does Robocopy sync in both directions?
No, Robocopy is one-way by default. It copies from source to destination. To sync in both directions, you’d need to run it twice with the source and destination swapped, but that can cause conflicts. A two-way sync tool is better for that.
What is the difference between /MIR and /E?
/E copies all subdirectories, including empty ones, but doesn’t delete anything in the destination. /MIR does everything /E does, plus it deletes files in the destination that no longer exist in the source, making the destination an exact mirror.
Can I sync folders on different drives?
Yes, Robocopy and third-party tools work across drives, including external USB drives and network shares. Just make sure the destination is available when the sync runs.
Is there a way to sync in real-time without scheduling?
Yes, tools like FreeFileSync’s RealTimeSync or SyncToy’s “Sync” command can watch a folder and trigger a sync whenever a change is detected. This runs in the background and requires the tool to be running.
Will syncing delete files in the destination that I want to keep?
Only if you use /MIR or a “Mirror” mode. If you use /E or a “Copy” mode, files in the destination that aren’t in the source will remain untouched. Always review the sync preview before confirming.
Can I sync a folder to a cloud service automatically?
Yes, if you place the folder inside your OneDrive (or Dropbox, Google Drive) folder, the cloud client will sync it automatically. You can also use the built-in Windows backup to sync known folders to OneDrive.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Fix Apps Not Downloading From Play Store
- Secure a Samsung Galaxy After a Zero-Day Disclosure
- What to Check Before Installing Linux Alongside Windows
- Fix OEM Activation Error 0xc004c060 in Windows 10
- Why Does My App Run One Query for the List and One per Item?
- Fix Google Chrome Has Stopped Working