Sync any folder in Windows To OneDrive

OneDrive - Simple remote access to Data

OneDrive is Microsoft’s storage service for hosting files in the “cloud”. It is similar in function to Google’s G Suite service called Google Drive. They both offers users a simple way to syncronise, store, and share various types of files, with other authenticated people and computers on the Internet.

For example, a small business could use OneDrive to provide access to the shared company data in times of a Covid-19 Coronavirus lock down and staff having to work remotely at home.

OneDrive is a useful service that gives you 5GB of cloud storage for free for those that have a Microsoft account. However it becomes much more useful if you have an Office 365 account (such as with any subscription of Microsoft Office 365) as you get a one terabyte (1TB or 1024GB) of online storage with your subscription.

1TB is almost always enough space to host an entire small business’ data on Microsoft’s infrastructure.

 

OneDrive "Existing Folder" Limitation

However, OneDrive does a major limitation, like sycronising any existing folder in Windows to OneDrive. At time of writing you cannot get OneDrive to link an existing folder with company data in it to OneDrive by using the application alone.

And this poses a big problem since we usually have a company folder shared on a server-like device that we want hosted online in OneDrive so staff can get to it remotely.

We don’t want to break any existing setup in the local network by moving data out of this shared folder and into OneDrive – this will most certainly break the locally shared folder’s ability for local users to see data.

The following steps addresses this issue and provides an excellent workaround. Best of all, we use Microsoft’s classic command mklink to achieve this and it doesn’t do any destructive changes to your current system.

Business Work From Home Needed?

Setup Remote Computer Access for your business at no upfront cost. Be ready to activate access quickly if or when you need it.

Getting OneDrive to Sync An Existing Folder

The way to solve is by using normally unheard of feature called Symbolic Links in Microsoft Windows.

Symbolic links are basically advanced links to either a folder or a file and places that link in another location. And the command to use is called mklink. You run from a command prompt.

Run the following command from within a command prompt on the Windows machine containing your data in the shared folder.

The originalFolder is c:\CompanyData in our example. Obviously you will need to adjust it to your environment. Also targetFolder should not exist, since it’s going to be crearted by the command, and needs to be located inside your configured OneDrive setup.

For our example, OneDrive is configured for c:\users\jason\OneDrive, and we made DATA our symbolic link. Because it’s situated inside OneDrive’s folder structure, the OneDrive app running on this machine will see this and syncronise the entire c:\CompanyData into OneDrive cloud storage.

REM mklink /J <targetFolder> <originalFolder>    (this is a comment line, for mklink parameter reference)
mklink /J "C:\users\jason\OneDrive\DATA" "C:\CompanyData"

Note! If you get the “Cannot create a file when that file already exists.” when running the mklink command it usually means you have the targetFolder and originalFolder parameters reversed.

However, before switching those parameters review the entire command again and make sure it is absolutely correct!

Solving the Sync Any Windows Folder OneDrive issue

This is a simple method in getting OneDrive to sync any Windows folder, namely your important business documents. This will greatly assist in getting remote staff to see company data.

Now all you have to do is wait for OneDrive to finish syncronising the data to the cloud and configure the remote computers for OneDrive with the same Microsoft account. And you’re done!

The mklink command reference from Microsoft is here;
https://docs.microsoft.com/en-au/windows-server/administration/windows-commands/mklink

Like this article?

Share on facebook
Share on Facebook
Share on twitter
Share on Twitter
Share on linkedin
Share on Linkdin
Share on pinterest
Share on Pinterest