Add Any Folder or File to OneDrive without Moving it to your Documents Folder

Add Any Folder or File to OneDrive without Moving it to your Documents Folder

Jan 16, 2024 | Microsoft 365, Computer Support, Desktop Support

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? In my case, I prefer to keep my frequently accessed files on lightning fast NVMe SSDs. But I also have extremely large, infrequently accessed files stored on a large mechanical hard drive. It would be a waste of money to tie up expensive storage with data like this. I recently had reason to grant access to some of these files to another team member, but I’m not saving them in my fast storage location(s). So I needed to manually link the folder to my OneDrive using what is known as a simlink. Here’s how I did it!

The Dos command that we want to use is mklink. It will create what is known as a simlink between file locations. This basically tells your computer to pretend that a folder or file exists in two different places at once. But you’re not actually moving the location of your assets. What you’re really doing is linking a file or folder item to another location. ie, it’s a simulated link.

A symbolic link contains a text string that is automatically interpreted and followed by the operating system as a path to another file or directory. This other file or directory is called the “target”. The symbolic link is a second file that exists independently of its target. If a symbolic link is deleted, its target remains unaffected. If a symbolic link points to a target, and sometime later that target is moved, renamed or deleted, the symbolic link is not automatically updated or deleted, but continues to exist and still points to the old target, now a non-existing location or file. Symbolic links pointing to moved or non-existing targets are sometimes called brokenorphaneddead, or dangling.

https://en.wikipedia.org/wiki/Symbolic_link

Get to the Command Prompt with Administrator Rights

  • Click the Start Button (or even better – press the Windows key!)
  • Type cmd
  • Right click the Command Prompt icon, and choose Run as Administrator
mklink /D "<path to your new OneDrive Asset>" "<path to your local asset>"
  • /D – this flag tells Windows that you will be targeting a Directory. This means Windows will also link the contents within.
  • <path to your new OneDrive Asset>
    • This would be where you want the folder to appear in OneDrive. It’s usually, but not always, c:\Users\<username>\OneDrive . Sometimes you might have a longer name to differentiate between different OneDrive installations.
      • <username> would be the user name you use to log in to your PC. If you’re [email protected], your <username> would be johnsmith.
      • You might want to include a folder name in your path. Otherwise, the assets will appear in the root of your OneDrive folder. Things could get messy really quick!
  • <path to your local asset>
    • This is the path to the folders or file that you want to add to your OneDrive
  • Don’t forget the quotes!
    • Your OneDrive location and your local asset location are being passed as strings – characters of text.
  • About finding your folder/file paths
    • If you aren’t sure what your paths are for this operation, you can use File Manager to find the information visually. Open File Explorer and navigate to your OneDrive folder or your Asset folder. Look near the top for the address bar, and click on it. You’ll see something like “c:\Users\<username>\OneDrive . This is your path.

Check if your Folders or Files are now part of your OneDrive

  • Open your OneDrive. If you did everything correctly, you should see your folder or file’s simlink there. Remember – we’re not actually moving the folders. We’re just pointing to a different location.
  • You should notice the “sync icon” next to your freshly moved assets.
  • Data will migrate into the cloud and any other OneDrive connected devices according to the configured sync settings for each device.

Conclusion

There you have it – how to add any folder or file into your OneDrive Account, without copying the file. You also learned how to access the DOS Prompt with administrative rights, how to determine file paths, what a simlink is, and how to use the mklink command. Hope it helps to make your computing life a little easier!

PS – Are you looking for Microsoft 365 Support?

Inacom is one of the fastest growing M365 partners in the mid-Atlantic. We support all types of organizations, including government, non-profits, manufacturers, professional services and medical. Our clients use our Managed IT Services and Remote Help Desk to keep their staff productive. We’d love to speak with you about taking over your Microsoft 365 tenant. Or if you’re considering a move to M365, we offer FREE Microsoft 365 Migrations!

Travis Fisher

Travis is Inacom’s Executive Vice President, tasked with assisting customers with their web based marketing initiatives. He’s kinda famous for his BBQ. He lives in Easton, MD with his amazing wife, two kids, and two dogs.

0 Comments

Looking For a great IT service provider?

Recent Posts