How to OneDrive Folder Sync Any Directory via Mklink

Microsoft OneDrive provides Windows 10 users with enough space to back up their documents in the cloud free of charge. However, you may have also noticed that the OneDrive sync folder is its own entity on your PC.

Anything outside of the directory won’t be stored in the cloud, which can be frustrating if you want to backup pictures, downloads, or game saves as they’re created. Today we’re going to show you how to enable OneDrive folder sync for any directory via mklink. If you are looking for a replacement to the buried OneDrive Fetch Files feature, please check here.

What is a OneDrive mklink?

mklink is a Windows command that lets users create symbolic or hard links between directories and files. You can think of them as a full shortcut, where the link doesn’t just point to a folder – it makes Windows think its contents are actually there.

We can utilize this feature to create a OneDrive mklink junction in our OneDrive sync folder that points to the directory of our choice. For all intents and purposes, OneDrive will now think it has ownership of the files, but the originals will remain. Here’s how to do it:

How to Sync a Local Folder to OneDrive via mklink

This process only takes a minute and doesn’t require any additional setup. The only restriction is the amount of space in your OneDrive account; if you try to sync a large folder you may hit your storage limit. Also bear in mind that uploading files every time they change will use data, which could be a problem if you’re on a metered connection.

  1. Open Command Prompt

    Press the “Windows” button and type “command prompt”, clicking on the first result.

    Windows 10 - Open Command Prompt

  2. Create a OneDrive mklink to add a folder to OneDrive

    In command prompt, type the following command, being careful to adjust it to suit your preferences using the information below:

    mklink /j "%UserProfile%\OneDrive\Documents" "C:\Users\Winbuzzer\Documents"

    You should choose folders to sync to OneDrive yourself. The first quotations contain the name you want the folder to appear as after \OneDrive. This can’t be the same as an existing directory. The second should be the source folder you want to link, with Winbuzzer\Documents replaced with your username and the folder or another location entirely, such as "D:\Films".

    Windows 10 - Command Prompt - Type the Command

  3. Wait for the app to Sync the local folder to OneDrive

    If you head to your source folder, you’ll see that it’s still there, unchanged.

    Windows 10 - Source Folder Location
    You can now head to your OneDrive folder, where you should see the OneDrive mklink with the folder name you specified. In our case, “Documents”.

    Windows 10 - OneDrive Location
    Next to it will be a ? icon if it’s still syncing, or a ☁ if it’s fully synced.