A - Introduction
Microsoft OneDrive is a file-hosting service operated by Microsoft. First released in August 2007, it allows registered users to store, share and sync their files. OneDrive also works as the storage backend of the web version of Microsoft 365 / Office.
In this article, we will describe to add Folder/File, that is outside of OneDrive Folder, into OneDrive without Moving.
- A - Introduction
- B - Issue
- B -1 - OneDrive Default Folder and Contents
- B -2 - Add a Folder/File that is outside of OneDrive Folder into OneDrive without Moving
- C - Solution --- Implementation
- D - Concept: What and Why
B - Issue
OneDrive is the cloud storage solution for Microsoft’s 365 Service. Out of the box, it selects the most common locations for important files, and it synchronizes data within those locations to the cloud. This is a great solution so long as your workflows are not “outside the box” that Microsoft gives you to play with. But
- What if your system utilizes multiple drives?
- What if you just like to store files in other places because it works better for you?
B -1 - OneDrive Default Location and Contents
Location
Out of the box, usually, the OneDrive folder is at location: c:\Users\<username>\OneDrive, such as

or

Contents
From Windows Task Bar => Click OneDrive Icon => Click Help & Settings on the top right corner:

In the OneDrive Settings Window => Click Account => Click Choose Folders.

The subFolders in OneDrive will be shown like this.

You can choose to hide some folders you do not like them in local OneDrive (File Explorer), i.e., they are stored in OneDrive Server (Cloud), but not synchozied to your local.

B -2 - Add Folder/File outside of OneDrive Folder into OneDrive without Moving
Add Folder/File into OneDrive
It is simply just adding the folder or file you want into the OneDrive Folder or sub Folder:

Add Folder/File outside of OneDrive Folder into OneDrive:
However, in some circumstances, one wants to keep folders or files outside of the OneDrive Folder while still wanting to store them in OneDrive on Cloud. For example, the folder SNV and Temp under the root directory:

SVN folder is a local SVN cloned repository. By system setup, it is required to be in this certain location,

while the Temp folder, by habit, it is used for TortoiseSVN patch file stored location. For consistency, it is better to be kept in that location.

Now, the issue is how to add these Folders/Files that are outside of OneDrive Folder into OneDrive without Moving them.
C - Solution --- Implementation
We use the command, mklink to create a directory or file symbolic or hard link to link the folders/files to the OneDrive Folder.
We have these two folders that will be moved into OneDrive:

and this file too:

Open a command link console with admin right, then type the three mklink commands:
- mklink /d C:\Users\gghan\OneDrive\mySQL C:\SQL2019
- --- Make a symbolic link between folders
- mklink /j C:\Users\gghan\OneDrive\mySWSetup C:\SWSetup
- --- Make a Junction between folders
- mklink /h C:\Users\gghan\OneDrive\myFile.txt C:\temp\myTestFile.txt
- --- Make a hard link between two files:
like these:

After moving the folders and files, in the OneDrive Settings window, we can see the two linked or newly added Folders:











Join the conversation! Your thoughts help the community grow.