Share via

How can I sync two local folders in Windows 11?

Anonymous
2025-06-02T19:29:46+00:00

I’m looking for a solution to keep all subfolders and files in one folder in sync with a duplicate folder on the same PC.

Specifically, this is my Documents folder. Even though this folder on OneDrive, with all its subfolders and documents, is automatically replicated locally on my PC, I need to have another copy of this whole folder because the one being maintained by OneDrive is under a location named “OneDrive” and can’t be accessed by my backup service (Backblaze). 

The way around this I came up with is to create another Documents folder that does not fall under “OneDrive”. I’ve done this by copying the whole Documents folder to a different location on my C drive and it works perfectly because it’s now picked up by the backup service. Here are the 3 paths, as shown in File Explorer, that I have for these folders:

  1. OneDrive > My Name - Personal > Documents (The one straight to OneDrive.)
  2. OneDrive > This PC > OS(C:) > Users > My Username > OneDrive > Documents (This is where OneDrive locally stores the files and isn’t accessible by the backup service.)
  3. OneDrive > This PC > OS(C:) > Users > My Username > Documents (This is the one I created by copying and pasting the whole Documents folder under OneDrive. This is now included in the backup, and is where everything needs to be kept updated. I could probably accomplish this by doing a separate “Save As” when I close any files, but I could see things falling between the cracks with this method.)

In my research I keep seeing suggestions to set up “robocopy” and then Task Scheduler. While I understand the concept, trying to make sense of the syntax to write a Windows Command Prompt and knowing where to add it is way beyond me. If these commands are something someone could write out for me, using my own information, and tell me where I would need to copy and paste it to, it would really be appreciated. Also, if anyone has a better solution for my dilemma, I would appreciate hearing about that!

Windows for home | Windows 11 | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Brian Tillman 25,040 Reputation points Independent Advisor
    2025-06-02T23:09:08+00:00

    Hi. I'm Brian and I will do my best to help you.

    One good way is by using either SyncToy (originally provided by Microsoft) or Synthing. Both are free and very flexible. FInd the first at

    https://www.majorgeeks.com/files/details/micros...

    and the second at

    https://syncthing.net/

    Note that the web sites I referenced aren't Microsoft web sites but they appear to contain accurate information and no potentially unwanted apps. They may, however, contain ads and use cookies, so be aware.

    2 people found this answer helpful.
    0 comments No comments

6 additional answers

Sort by: Most helpful
  1. Anonymous
    2025-06-02T21:28:52+00:00

    Hello Pat! Thank you for reaching out. I am Tin, an independent advisor, and glad to assist you today with this issue. Here are some steps to take to setup your preferences by using Robocopy or Task scheduler.

    *Identify your folder paths.

    *Here is the Robocopy command.

    [robocopy "C:\Users\YourUsername\OneDrive\Documents" "C:\Users\YourUsername\Documents" /MIR /Z /XA:H /W:5 /R:3 /NFL /NDL /NP /LOG:"C:\Users\YourUsername\robocopy_log.txt"]

    *Save this command to a batch file. Open a Notepad. Paste the Robocopy command above. Replace YourUsername with your actual Windows username then save the file as sync_documents.bat on your Desktop or another folder you like.

    *Test your batch file, double-click sync_documents.bat to run it manually.

    *Set Up Automatic Sync with Task Scheduler, to automate this press Win + S, type Task Scheduler, and open it. Click Create Basic Task on the right. Name it, e.g., “Sync Documents Folder”. Choose a trigger, then select Start a program for the action. Browse and select the sync_documents.bat file you created. Then Finish on the wizard.

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2025-06-04T01:26:01+00:00

    Hi Pat,

    Can you check try the troubleshoot the issue?

    *Confirm the task exists and is set up correctly, open the Task Scheduler then expand Task Scheduler Library then find your task. Right-click then Properties on the General Tab, “Run with highest privileges” should be checked and “Configure for” set to your version of Windows. Then under Triggers Tab, ensure the trigger is set to “At startup”. Under Actions Tab, Make sure the action is “Start a program” and the program/script should be [cmd.exe] then add arguments [/c "path\to\your\script.bat"] replace path\to\your\script.bat with the actual full path to the batch file. Under Conditions Tab, uncheck “Start the task only if the computer is on AC power” and uncheck “Start the task only if the network connection is available”.

    *Manually run the task, in Task Scheduler, right-click the task and choose Run. Check if the file gets copied to the local folder. If it doesn’t work, the problem is likely in the batch script itself.

    *Add logging to the script to capture errors, edit your .bat file and make it like this @echo off

    echo %date% %time%: Starting script >> "%USERPROFILE%\Desktop\sync_log.txt"

    xcopy "%USERPROFILE%\OneDrive\Documents\YourFile.docx" "%USERPROFILE%\Documents\CopiedDocs" /Y >> "%USERPROFILE%\Desktop\sync_log.txt" 2>&1

    echo %date% %time%: Script ended >> "%USERPROFILE%\Desktop\sync_log.txt".

    Replace "YourFile.docx" with the name of your test file. After a reboot or task run, check the sync_log.txt file on your Desktop to see what happened.

    *Check if OneDrive is ready at startup, if OneDrive hasn't fully synced at system startup, the file might not be available yet. Add a delay in your script before the copy command [timeout /t 30]. Put this right before the xcopy command to wait 30 seconds after login/startup.

    0 comments No comments
  3. Anonymous
    2025-06-03T01:23:09+00:00

    Hi Tin and thank you so very much for your response and very detailed instructions for someone who has no idea what any of this means! However, I think I have a glitch and am not sure how to fix it. Here's what I've done:

    I created the batch file and saved it to my desktop. I double clicked on it and it looked like a screen was going to open: It was a faint gray box that briefly appeared and disappeared, so I don't know if that means the test was successful or not.

    I then went through the steps to automate the process in Task Scheduler. I followed all the steps, choosing the trigger of when the system is started, and this all seemed to be successful . (After I had finished I tried to find what I had saved to verify that it was there, but I couldn't find it.)

    I created a Word doc in OneDrive, then closed it and verified that it had synced up to the local OneDrive Documents folder. I also looked into my newly created Documents folder and verified that this new file wasn't there.

    I closed out of everything and restarted my computer. My expectation was that the restart would trigger the process and the file would be copied and added to this newly created folder, but it wasn't there when I first looked, or when I went back to look.

    With this information can you tell me what I should do to diagnose and fix the problem? (I won't be available to play around with this until later in the afternoon of June 3.)

    I really appreciate your help with this!

    0 comments No comments
  4. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more