Synchronizing any folder on your system with OneDrive

David Meego - Click for blog homepageThis is a reposting of an article I originally wrote on my Developing for Dynamics GP blog.

In my last post: Backup regimes and synchronizing folders across your network, I discussed my method of backing up data from four folders off the root of the drive across my network and how I use the free SyncToy 2.1 tool from Microsoft.

So in this post I wanted to take it to the next level.


Introducing the Cloud

Here is the next bit of the puzzle…. Cloud storage. Everything so far has been based on local hard drives, but I have OneDrive storage and wanted to use that at least for My Documents and the Music and Pictures from my Media. This would make those three areas of my data available from anywhere I had an internet connection including my Windows Phone.

I am using Office 365 to provide Microsoft Office to the family (it allows 5 machines). It also provides 1TB of OneDrive storage per user.

When OneDrive is installed (or comes with Windows 8.1) it sets up a single folder in the user folders and will Synchronize anything in that folder with OneDrive storage in the cloud.

So how can I get OneDrive to synchronize with my folders C:My Documents, C:MediaMusic and C:MediaPictures as well as the existing data (such as OneNote files and the phones camera roll).

One article I read on the topic, said to Pause Syncing by right clicking on the OneDrive icon in the system tray and then move the desired folders into the OneDrive folder and then resume Syncing. However, that MOVED the folders into a user folder: Exactly the thing I was trying to avoid by using folders off the drive’s root folder. It would also break all the SyncToy configuration that I already have in place. So that is no good.

I wanted a method of mapping a folder from the data I want synchronized to the OneDrive folder.

Using a shortcut to the folder did not work as OneDrive just backed up the .lnk file. Most of the mapping techniques I found either mapped a network drive to a drive letter, or mounted a drive into an empty folder (the method I used with the micro SD card).

By then I found this article (and later this article) with the method I was looking for. It contained the command a “directory junction” on the Window NTFS File system. While the folder can point to a different location, OneDrive sees it as just another folder and will sync it as normal.

mklink /J  “C:Users<USERNAME>OneDrive<Folder>” “C:<Folder>”

Note: You will need to change the <USERNAME> and <Folder> placeholders. For older machines, you might find that the OneDrive folder is actually still called SkyDrive.

I used the %USERPROFILE% environment variable and a little bit of batch file logic to create a batch file which will create the links for me on demand.

I have attached the two batch files (one for the My Documents folder and one for the MediaMusic and MediaPictures folders) to the bottom of this article.



Here are some guidelines that I think will make the OneDrive approach to synchronization work better.

  • Don’t try to use both OneDrive synchronization and SyncToy synchronization at the same time for the same folders.
  • I suggest moving your data out of the folder you are creating the link to, so the folder is initially empty. Then on each machine linked to the same OneDrive account, run the mklink command and wait for OneDrive status to say “Files are up to date”.
  • Then you can copy the files into the folder on one machine and let OneDrive upload them to the cloud storage. Then OneDrive on the other machines should bring the files down again. This should avoid the issue where OneDrive creates duplicates of the files when it finds files already existing.
  • If you have a lot of data, you will be using a significant amount of your internet allowance (unless you are unlimited) to send and receive all the files to multiple machines.
  • If your internet speed (especially upload speed) is slow, this process can take a long time for the initial upload and downloads.


Hope you found this information useful.


PS: After finding the process too slow and getting too many duplicated files, I decided to stick with my SyncToy method for the My Documents folder as it was faster and more reliable.

PPS: I am still uploading my Music and Pictures to a secondary OneDrive account that I don’t use as a primary account on any machines. This is creates a “cloud” backup, but will not be synchronized to any other machines.

Map to

This article was originally posted on the Developing for Dynamics GP Blog and has been reposted on

29 thoughts on “Synchronizing any folder on your system with OneDrive

  1. IMHO, needing them to be in the root folder makes this more difficult than it needs to be. For all non-work PCs OneDrive is the default documents folder. Once you manually change the various built-in library folders (pictures, videos, etc…) to point to a OneDrive folder then new items will automatically be backed up to OneDrive. Let it spend the first half day syncing up whatever monster music collection you have (lots of files = lots of overhead). Once it's done you'll never lose them.
    File History can serve a similar backup function – I used to back up to an external usb drive attached to my wifi router but honestly see no need any more as long as I use the folders designated by the operating system for documents, videos, pics, etc… OneDrive is more than enough.


  2. Hi old coder
    The default folders put the documents, pictures, music etc. into a user folder which is not easily accessible when you log into the machine as a different user.  A few of the machines in my network are accessed by multiple users and we want all the files accessible regardless of user used.
    As long as it works for you, that's great.


  3. Thanks a bunch for the tip, David! I have over 150GB of images for my landscape photography work and your symlink solution worked to get OneDrive to back them up. I have my images on a separate SSD from my boot disk so I was forced to send them to OneDrive manually (what a pain!) but this way I was able to link my SyncToy nightly backup directory on my local RAID array to OneDrive and have everything automatically upload.


  4. HI, Isn't there a way to right click on a folder/file through ms explorer and select (i forgot the exact term) "sync with onedrive" or something? I KNOW i was able to do it a while back but since then I have replaced my primary OS Disk then recently had another storage disk fail on me, fortunately I had one of the folders on that failed disk linked to onedrive so it alone was saved, Unfortunately that was the only folder saved, anyway How do i get that right-click option back? The folder wasn't moved to the onedrive folder and I don't remember doing anything with cmd or outside apps just right-click folder and sync…. I can't seem to find what it on a google search.


  5. I had it working fine with Windows 8.1 when the article was written. The article even references Windows 8.1.
    NK and BB, I suggest you try it again.


  6. As it turns out – Directory Junctions can only be used on local volumes. Network drives cannot be mapped using mklink – which is sad.
    So I guess, the headline should be changed to read; synchronizing-almost-any-folder-on-your-system-with-onedrive


  7. I think it’s confirmed below but I’ve tried this on Windows10 to an external HDD. It appears to only work one way. I can add files to OneDrive and they appear everywhere, but if I add them to the external HDD they are not replicated to OneDrive. Is this expected or have I missed something?
    I’ve tried the same with the folder elsewhere on an internal HDD and it all works OK as expected.


  8. I am trying to get onedrive windows 10 to sync a folder which is located on a Synology NAS network drive.
    Can someone please confirm whether or not windows 10 allows mklink to create a folder link inside c:/onedrive to trick onedrive into syncing the folder on the network drive?


    • It can but the problem is that if you’d ever have to reset the OneDrive sync it will look at how much data is stored in the cloud and compare it to how much space is available on the drive holding the root OneDrive folder. The cloud storage can be larger than your root drive because you’ve faked it into backing up your NAS storage via the junction.

      So junctions are cool but OneDrive is too clever about protecting the user. I have Office 365 with 1TB, a 100GB SSD in my laptop (C:) and my pictures, music, videos on a HD in the drive bay (D:). After a reset on OneDrive I can no longer sync everything because it says there is not enough room on C: even though I’ve junctioned all the big stuff to D:. My solution seems to be to move my OneDrive root to D: and junction Documents to C:. This should work as I have enough free space on D:. But what a pain!


  9. This is a great help to adding other folders to be synced to OneDrive. Thanks! I have one question, though: It’s my understanding that if a folder is deleted in OneDrive, then it will be deleted in the cloud and that deletion will be propagated to any other computers linked to the OneDrive account. For instance, if I sync my Desktop folder using “mklink /J “%USERPROFILE%\OneDrive\My Desktop” “%USERPROFILE%\Desktop”, how can I remove the OneDrive synchronization without deleting the My Desktop folder and its contents?


  10. In Windows 10, mklink cannot link a network drive. Always got “local volumes are required to complete the operation”, but external hard drive works.

    Not sure it’s just me or some changes Micro$oft made.



    • You can change this behavior by configuring the following Group Policy setting:

      Computer Configuration\Administrative Templates\System\NTFS File System\Selectively Allow The Evaluation Of A SymbolicLink

      When you enable this policy setting, you can select from four settings:

      Local Link To Local Target Enabled by default, this allows local symbolic links to targets on the local file system.

      Local Link To Remote Target Enabled by default, this allows local symbolic links to targets on shared folders.

      Remote Link To Remote Target Disabled by default, this allows remote symbolic links to remote targets on shared folders.

      Remote Link To Local Target Disabled by default, this allows remote symbolic links to remote targets on shared folders.


  11. guys,
    this is wrong
    mklink /J “C:\Users\\OneDrive\” “C:\”

    it should be
    mklink /J “C:\Full\Path\Link to be created” “C:\Full\Path\To\OneDrive\Existing Target Name”

    otherwise junction link will not be synced…


    • Hi mackarof

      I have folders off my c:\ drive root which I don’t want to move, but do want to have synchronized.

      So I have added the directory symbolic links to the OneDrive folder pointing to the existing folders.

      You are going the other way. Existing OneDrive folder made available off root folder.

      This might work better for automatically synchronise, but the synchronising does work the way I have it, but it does not always start immediately. If it does not, you can always pause and resume the Onedrive process to make it sync.

      Thanks for your comments.



  12. I am not very skilled at this level. Will this work if the folder I want to have synced (copied/saved in the cloud on OneDrive) is on my desktop or do I have to move it directly to my C: ??


    • I figured it out; I think. I did not have to do anything with mapping. I just hadn’t synched in so long, that when I asked Cortana for help, she lead me the way. All I needed to do was drag & drop or copy and paste. I had already created the folder in OneDrive with the same name as the desktop folder. Now everything is up to date. Now I just need to figure out how to properly set up my Seagate.


Please post feedback or comments

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.