Set Up OneDrive Sync and Backup for Any Path

13,881 6

During the holiday, I organized some photos and videos from the past two years. I kept a lot of video footage, all of which is very important. To ensure the safety of this data, I need to back it up to the cloud.

The best sync and backup solution I have used is probably iCloud. Unfortunately, it does not work very well on Windows, so I chose OneDrive.

A default OneDrive account only has 5 GB of storage, which is clearly not enough. So I subscribed to the Office 365 Home plan and upgraded to 1 TB of storage.

Next, I wanted to sync and back up all my data to OneDrive. However, I discovered that OneDrive can only back up a few default paths, and they cannot be modified.

These paths are all located on the C: drive. I allocated little space to the C: drive because it only contains some system files and software whose installation paths cannot be changed. Therefore, there was no way to put all my media files in these directories.

I don't know why OneDrive does not allow the backup paths to be changed. Fortunately, there is another way to solve this problem: the mklink command.

CMD
MKLINK [[/D] | [/H] | [/J]] TargetLink OriginLink

Here:

/D 创建目录符号链接,默认为文件符号链接
/H 创建硬链接,而不是符号链接
/J 创建目录联接
TargetLink 为目标地址
OriginLink 为原始地址

For example, if I want to back up the E:\Album path to OneDrive, I would write it like this:

CMD
mklink /d "E:\OneDrive\Album" "E:\Album"

E:\OneDrive is the path to OneDrive.

Open the CMD command prompt. You must open it in administrator mode, then enter the command and press Enter. If the following content appears, it means everything is correct.

You can then see that the files to be backed up are already in the OneDrive directory. Wait for synchronization to complete.

There are two things to note. First, you do not need to create the directory in the OneDrive directory in advance; just create it directly with mklink. Second, if the folder path contains spaces, enclose it in quotation marks.

Comments

(6)
  1. Chrome 79 Windows 10

    wow一直很喜欢你的博客,请问这个Windows的UI是怎么改的分享一下吧

    1. Chrome 80 Windows 10

      教程文章 https://zhutix.com/study/win10-jc/ 主题文件 https://www.lanzous.com/i7jzt3i 主题介绍 https://zhutix.com/pc/iconadams-vs/

  2. Vulcanyrie
    Edge 81 Windows 10

    您是在哪使用的mklink指令呀,请原谅我这个菜鸟找不到?

    1. Edge 81 Windows 10

      是CMD是嘛,打扰了 ::aru:shy::

  3. KZ
    Edge 89 Windows 10

    贼溜,用上了,很好用,谢谢科普~~

Leave a comment

© 2026 Carefree. All rights reserved.

Carefree is a personal site about technology and everyday life, documenting web development, backend, and DevOps practices, plus software tools, digital experiences, and thoughts beyond code.