Sync Any Folder to OneDrive in Windows 10

OneDrive is the online document storage solution created by Microsoft which comes bundled as a free service with Windows 10. It can be used to store your documents and other data online in the cloud. It also offers synchronization of stored data across all your devices. "Files on-demand" is a feature of OneDrive which can display placeholder versions of online files in your local OneDrive directory even if they were not synchronized and downloaded. Today, we'll see how to sync any folder to OneDrive so it will be available from any device connected with your Microsoft Account.

To make OneDrive sync a folder which is not located in your main OneDrive folder, we will create a directory junction. Directory junctions and other symbolic link types are covered in detail here:

Advertisement

Everything you need to know about symbolic links in Windows 10

I recommend you to read the article above if you are not familiar with symbolic links.

In short, a directory junction is a classic type of symbolic link, which does not support UNC paths (network paths that begin with \\) and relative paths. Directory junctions are supported in Windows 2000 and later NT-based Windows systems. A directory symbolic link on the other hand also supports UNC and relative paths. For today's task, directory junction is suitable.

To sync any folder to OneDrive in Windows 10, do the following.

  1. Open an elevated command prompt.
  2. Type the following command: mklink /j "%UserProfile%\OneDrive\Folder name" "The full path to your folder". You need to substitute the 'Folder name' portion with the desired name which will reproduce your folder in the OneDrive storage. Also, provide the correct path to the destination folder that you want to sync. For example:
    mklink /j "%UserProfile%\OneDrive\Winaero-folder" "c:\data\winaero". Windows 10 OneDrive Sync Any Folder
  3. The specified folder will now be synced with your OneDrive.Windows 10 OneDrive Added Directory Junction
  4. To stop it from syncing, remove the 'Folder name' (e.g. 'Winaero-folder') from the OneDrive folder. This won't remove your actual folder from your drive (e.g. 'c:\data\winaero').

See the following screenshot:

Windows 10 OneDrive Syncing Directory Junction

That's it!

Related articles:

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

4 thoughts on “Sync Any Folder to OneDrive in Windows 10

  1. Kristopher Franzen

    how do I add a junction into program files (x86)?

    Reply
  2. Brad

    This is great! BUT OneDrive says that it has “No access permissions to the item”. How do I change permissions so that OneDrive CAN access any item on my PC?

    Reply
    1. Jax

      Gotta establish the link as an administrator and run as administrator

      Reply
  3. Lukáš Zoubek

    Hi,

    Can I use this on two PCs?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *