Windows – Syncing OneDrive by mirroring the local folder to the cloud not the cloud to the local folder

onedrivewindows

I want OneDrive to have the exact files and folder structure of a folder on my local computer. Syncing OneDrive causes the files in the cloud to download and only uploads files that I add to the local folder while the OneDrive app is running. How can I make the local folder unchangeable and the Cloud folder mirror from the local folder by uploading local files that aren't in the cloud and replacing or duplicating the files into the cloud from local files that have the same name and location in both local and cloud drives and different hash values?

Please note: The folder is almost 160 gigs and I currently only have access to a very slow connection so I have to keep the files that are already uploaded and can't just recopy the entire folder into the cloud like when I had fiber optic.
The folder contains 18,873 Files so manually comparing files is also not possible.


To future readers with the same problem: Using the command net use described in the duplicate problem will not allow replacing the cloud version with the local version because it maps the drive as if using the onedrive app(where OneDrive automatically downloads synced folders:

enter image description here

Whereas the way described below maps the drive as I needed:
enter image description here

Best Answer

For future users: I solved my problem by mapping the drive using the instructions with pictures found here on laptopmag.com. In Case the site moves etc...

  1. Log into Onedrive.com.
  2. Copy the CID number from the address bar. These are the digits and letters after the "cid=" part of the URL. Don't include any other characters that separate the CID, such as % or &.
  3. In Windows Explorer, go to This PC.
  4. Click on the Computer tab then "Map network drive".
  5. In the Folder field, enter https://d.docs.live.net/ followed by the CID you copied in step 1.
  6. Check the "Connect using different credentials" box.
  7. Click Finish and enter your OneDrive login

Please note: The alternative command line method described on superuser here using net use does not work for my problem as it caused the drive on my computer to map as a one drive folder which is no different that using the app.

For some reason the Gui map as network drive created a mapped drive that I can copy the folder to the existing cloud folder. Robocopy automatically ignores identical files in source and target while changed local files replace the destination cloud files. With /mir option the files on the destination that aren't in the source are removed so for now I can get by with robocopy .\src .\dest /mir.


Update: Using robocopy used to work or has worked before on onedrive mapped as a network drive, however as noted in the comments by some at the link I got permission errors in creating folders and files "ERROR 5 (0x00000005)" when using robocopy. As an aside syncback pro worked great as a temporary solution because it has a full featured 30 day trial and I only needed to do this once but it is a paid app which is not a valid answer to a question. There are always free solutions and alternatives, one that I haven't tried can be found here.

Related Question