onedrive sync with any drive or folder

OneDrive is a great tool for document storage and collaboration from Microsoft. It provides 1TB cloud storage space with premium license. It has document syncing capability, using which you can connect the cloud storage to your PC. OneDrive sync can be enabled in up to 5 devices.

Although OneDrive is great but it has a flaw. OneDrive allows syncing with only their default libraries(i.e. OneDrive folder, Desktop, Documents & Pictures). So if you need to sync some files which are not from these default OneDrive libraries, then this can be a big concern. However this can be achieved using something called mklink(symbolic link) in OneDrive. symbolic link helps to connect a folder with another one using reference.

Who this tutorial is for?

This tutorial can help you with the below

  • Sync non-OneDrive folder with OneDrive
  • Connect other drives/folders with OneDrive
  • How to create symbolic link for OneDrive
  • How to use mklink command to sync with OneDrive

What is a symbolic link

In computing, a symbolic link is a term for any file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution. This is useful to create shorter file paths or to create shortcuts of files / folders in another directory for quick access.

Here we will use the symbolic link to create a reference from local drive to OneDrive.

To learn more check this document https://en.wikipedia.org/wiki/Symbolic_link

What is “mklink”

mklink is a Microsoft command for cmd(command prompt). This command helps to create directory or file symbolic or hard link.

The syntax of mklink command is as follows
mklink [[/d] | [/h] | [/j]] <link> <target>

How to use mklink to create directory junction

To create directory junction using mklink is very simple. Follow the steps below

#1. Open command prompt in admin/elevated mode

open-cmd-admin for mklink

#2. paste the command as shown below

mklink command with details for OneDrive

#3. Check the folder in your OneDrive

After the above code is successfully compiled, your non-onedrive folder should appear in your OneDrive location as below.

mklink, symbolic link successfully created
symbolic link created successfully

The symbolic link is now successfully created. So what ever changes you do inside the non-onedrive folder will automatically get synced through the mklink-folder.

Benefit of mklink / symbolic link

Symbolic links are good when you cannot copy the folder contents to OneDrive. For example some project / application files only work in their root directory.
So if you need to backup/sync them through OneDrive then, mklink / symbolic link is pretty good.

How to remove mklink

To remove the mklink folder, simply just delete the folder(mklink-folder) from your OneDrive.

However the above method is not recommended as it will delete the files as well. So first make sure to copy everything in OneDrive then delete it. But if you do not need the files then delete it anyways.

remove onedrive mklink
delete
mklink-folder

Please Help us Grow!

I hope you have found this article helpful. If you are happy with the document, please use the below links when you buy something from Amazon to help us grow.

How this works?

Amazon affiliate program gives a small (%)share of price to the referrers, so feel free to buy anything.
Below are some Amazon affiliate links, if you open amazon application/website using these links and buy something, (it can be one of the below items or anything of your choice) Then Amazon will give us a little percentage(%) of the money you spend on Amazon. To know more check this document.

Amazon Affiliate Links

$350-Best Student laptop
Amazon In, Amazon US

$600-Work laptop
Amazon In, Amazon US

$989– High performance
Amazon In, Amazon US

Headset – $15.99
Amazon In, Amazon US

Lightspeed Mouse – $39
Amazon In, Amazon US

Keyboard – $29
Amazon In, Amazon US

The Psychology of Money
Amazon In, Amazon

Atomic Habits:
Amazon In, Amazon

Find Balance and Purpose in Life
Amazon In, Amazon

$30, Smart Watch for Smart you
Amazon In, Amazon US, Amazon UK

Work comfortably with $110
Amazon In, Amazon US, Amazon UK

Exercise at home
Amazon In, Amazon US, Amazon UK

More Ways to Help

Thank you
For your Contribution


Newbietechie.com
Author @ramizmollahmd

About Ramiz

Ramiz is a professional working in an MNC as a business and technology consultant for quite a few years now. Ramiz is proficient in various Microsoft tools and technologies. He is a tech enthusiast and an active blogger. Ramiz spends his free time playing games or watching movies. He writes blogs to share his knowledge with the world and to make it a better place to live.