How to Sync Folders to OneDrive in Windows 10 & 11

How to Sync Folders to OneDrive in Windows 10 and 11 blog banner image

This step-by-step tutorial demonstrates how to sync folders to OneDrive. This guide works with both Windows 10 and Windows 11, and provides clear instructions for syncing any folder to OneDrive, allowing you to back up and sync custom files and folders from any file system path, including external hard drives.

Prerequisites and system requirements

Before you start, you should make sure that OneDrive is installed and that your Windows 10 or Windows 11 PC is up-to-date. You should also make sure that you have enough OneDrive storage for the files you wish to sync — the free OneDrive plan gives you 5 GB for free, which is enough for some basic file syncing between devices, but insufficient if you are trying to back up large files or the contents of external hard drives.

How to Sync any custom folder to OneDrive using symbolic links

A symbolic link is like a shortcut, pointing to another location on your computer’s file system. Unlike a shortcut, however, what is being linked to is treated just like the original file. This means that if you create a symbolic link in OneDrive that points to an external folder, its contents will be synced. Symbolic links can point to any file or folder path, even if they are on a different storage device.

As symbolic links are created on the file system, OneDrive treats them as regular folders, meaning that following method will work for both OneDrive personal and business, and on both Windows 10 and Windows 11.

Creating a symbolic link is done using the mklink command:

mklink /d “%UserProfile%\OneDrive\Custom Directory” “X:\Custom Directory”

In the above example. The folder at the path X:\Custom Directory is added to OneDrive in the subdirectory Custom Directory. The /d option tells OneDrive to create a symbolic link. Note that the folder name inside OneDrive cannot exist, as the symbolic link that is created will conflict with it.

Note that if you have changed the location of your OneDrive folder from the default, you will need to adjust the path above.

Once this symbolic link has been created, both the original folder and the symbolic link will behave identically: modifications to files in one will be reflected in the other, though the data itself will only be stored on the device where the original directory is stored. Deleting a symbolic link will not delete the original directory. Once you have created your symbolic link in OneDrive, you should check the OneDrive online interface to confirm the files under it are syncing correctly.

Symbolic links are also known as symlinks or soft links. Symbolic links are different from hard links, which can only point to a file or folder on the same storage volume, making them unsuitable for adding folders from other partitions or external hard drives to OneDrive.

OneDrive syncing in Windows explained

OneDrive is a convenient file synchronization and cloud storage tool that comes pre-installed with Windows 10 and Windows 11, providing free online storage (with the option of paying for extra storage space) for your important files. OneDrive is useful for both working on files from different devices, collaborating on personal and business projects, and as an additional backup location to supplement your own on- and off-premises backups.

By default, OneDrive only syncs files in certain folders: The default OneDrive folder is stored in your user profile directory, and it can additionally sync and backup files on your Desktop or in your Documents, Pictures, Music, and Videos folders (and, notably, does not back up files outside these folders). This default behavior is fine for most users who just want to sync and work on their files, but is a limitation for users who want to use OneDrive to backup files from other folders or external hard drives, and want to do so without copying them to the default OneDrive directories.

To address this, in addition to being able to change the location of your OneDrive folder in Windows, you can specify additional folders to sync to OneDrive.

Troubleshooting common OneDrive sync issues

There are a few troubleshooting steps you can take to fix issues syncing custom folders to OneDrive:

  • Ensure the folder you have created a symbolic link for exists at the specified path (and re-create the symbolic link if it has been moved or renamed)
  • Ensure there is enough space in OneDrive
  • Check your internet connection, and be aware that it may take a long time to sync a large number of files
  • Check the OneDrive service status
  • Check for updates for OneDrive and Windows, and restart your PC
  • Check OneDrive for any warnings about files with invalid names that cannot be synchronized

Best Practices for backing up custom folders to OneDrive

It is important to understand that file sync is not the same as file backup: file sync tools like OneDrive are intended to keep your files up-to-date between devices and enable collaboration. As changes to files are immediately reflected across OneDrive, using it as your sole backup destination could be catastrophic if malware corrupts or infects files that are then synced (or, in this case, if your symlink breaks and stops working).

Additionally, if a malicious user gains access to OneDrive, they can delete files irretrievably by emptying the recycle bin. You should always maintain your own full system backups so that you can restore your systems and files to a known good state.

Using OneDrive as your only backup destination also carries the risk of losing access to your files if you cannot log in to your Microsoft account. This can be mitigated by ensuring the Files On Demand OneDrive feature is disabled, so all of your files are fully downloaded on each device and not left only in the cloud.

Additionally, OneDrive lacks configuration options. Requiring workarounds to add custom folders to sync is not ideal, and additional functionality like being able to prioritize certain files to sync is missing.

OneDrive folder backup isn’t enough to safeguard your critical business data

In addition to the issues mentioned above, using OneDrive as a backup destination carries additional risks to business: privacy regulations such as GDPR, CCPA, and HIPAA may restrict where you can store customer data, and you cannot risk core business data falling into the wrong hands via data breach or accidental sharing.

NinjaOne provides a comprehensive backup solution for your Windows and Mac devices, as well as your servers, putting you in complete control of what is backed up, and where and how your data is stored.

Next Steps

Building an efficient and effective IT team requires a centralized solution that acts as your core service deliver tool. NinjaOne enables IT teams to monitor, manage, secure, and support all their devices, wherever they are, without the need for complex on-premises infrastructure.

Learn more about Ninja Endpoint Management, check out a live tour, or start your free trial of the NinjaOne platform.

You might also like

Ready to simplify the hardest parts of IT?
×

See NinjaOne in action!

By submitting this form, I accept NinjaOne's privacy policy.

NinjaOne Terms & Conditions

By clicking the “I Accept” button below, you indicate your acceptance of the following legal terms as well as our Terms of Use:

  • Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms.
  • Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party.
  • Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library belonging to or under the control of any other software provider.
  • Warranty Disclaimer: The script is provided “as is” and “as available”, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations.
  • Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks.
  • Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script.
  • EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).