If you are using OneDrive to sync or backup your files to the cloud and want a little more control of what you sync / backup from your computer, Windows Symbolic Links might be a good option for you. You can kind of think of them as smart windows shortcuts. To Windows, it will think it's an actual folder located at the LINK location.
In this example, we are going to create a Symbolic Link from a folder which is located on a secondary drive D: , and make it sync into a OneDrive folder which is located in the default OneDrive path on the C: drive. The process is pretty simple, replace the paths with the paths of your own folders, and you should be off and running in no time.
- Click the START button & type Command Prompt or CMD in the search box to see Command Prompt entry in the results. Right-click on Command Prompt and then click Run as administrator.
- Click YES on the User Account Control UAC popup prompt.
- In the Command Prompt dialog, you can type your command using the following example where;
- Your OneDrive folder path is: C:\Users\Josh\OneDrive. This is the LINK. This is where Windows will think the folder is.
- The path of the folder you want to backup/sync to your OneDrive folder is: D: \Josh\Desktop. This is the TARGET. This folder's contents is what Windows will think is in the folder located at the LINK.
Once you've typed your command using your own paths, hit ENTER. You should see a successful message of
That's it! You should see a new Desktop "Folder" in your OneDrive folder both on your computer as well as on the OneDrive website (once it syncs, based on your local OneDrive settings). I would recommend working with the folder on your local computer using the local path D: \Josh\Desktop to keep things straightforward from a pathing standpoint. If you ever want to remove the link, just visit the OneDrive folder on your computer and delete the Desktop folder / Symbolic Link. It will only remove the symbolic link in the OneDrive folder and the files from the OneDrive web folder, and will leave everything as is in your D: \Josh\Desktop folder.
A few nice things about using Symbolic Links with OneDrive are;
- It allows you to backup ANY and ONLY the folders on your system you want to sync to OneDrive, not just the Desktop/Documents/Pictures folders.
- It lets you backup any folder without having to have your folder live inside your OneDrive folder, so you get to decide where your files live, not OneDrive!
Some more nice things about using Symbolic Links that can be used in general with Windows are;
- To Windows, the LINK looks exactly like a normal folder.
- You can pretty much create a Symbolic Link to and from anywhere on your local system and you can TARGET most remote paths like a network share.
- You could add new physical drives to your system and then create Symbol Links so that Windows looks at your new drive using the same path as your old drive, so you could virtually increase the size of a "drive" via folders and Symbolic Links .
- Once you get the hang of them, they can be VERY handy and you'll find all kinds of uses for them.
- You should be able to use them to work around other special kinds of folders that can give you a local path like Google Drive, DropBox connections, etc.
- If you run your OS on a smaller NVMe or SSD C: drive, you could create a Symbolic Link to a larger secondary drive, like an external USB / Thunderbolt drive and have it appear as if its a folder on your C: drive, at most any location.
Note the /D command switch which tells the mklink program to create a Symbolic Link vs. the other link options the program has. If you want to take a deeper dive into Symbolic Links, their related kin JUNCTIONS, and the other command switches, check out this thread I came across while doing my initial learning about Symbolic Links. They have some nice charts to help spell out the pros and cons of the other options, but Symbolic Links are the most up to date version on Windows pretty much these days and are fairly simple to work with.
If you get to where you really start to use Symbolic Links a lot, there is another useful command to list all of the different Symbolic Links (and Junctions, the other type of links) on a specific drive. Use the command below and specify the drive you want to check at the end.
In this example, we are going to create a Symbolic Link from a folder which is located on a secondary drive D: , and make it sync into a OneDrive folder which is located in the default OneDrive path on the C: drive. The process is pretty simple, replace the paths with the paths of your own folders, and you should be off and running in no time.
- Click the START button & type Command Prompt or CMD in the search box to see Command Prompt entry in the results. Right-click on Command Prompt and then click Run as administrator.
- Click YES on the User Account Control UAC popup prompt.
- In the Command Prompt dialog, you can type your command using the following example where;
- Your OneDrive folder path is: C:\Users\Josh\OneDrive. This is the LINK. This is where Windows will think the folder is.
- The path of the folder you want to backup/sync to your OneDrive folder is: D: \Josh\Desktop. This is the TARGET. This folder's contents is what Windows will think is in the folder located at the LINK.
Code: Select all
mklink /D C:\Users\Josh\OneDrive\Desktop D:\Josh\Desktop
Once you've typed your command using your own paths, hit ENTER. You should see a successful message of
Code: Select all
symbolic link created for C:\Users\Josh\OneDrive\Desktop <<===>> D:\Josh\Desktop
That's it! You should see a new Desktop "Folder" in your OneDrive folder both on your computer as well as on the OneDrive website (once it syncs, based on your local OneDrive settings). I would recommend working with the folder on your local computer using the local path D: \Josh\Desktop to keep things straightforward from a pathing standpoint. If you ever want to remove the link, just visit the OneDrive folder on your computer and delete the Desktop folder / Symbolic Link. It will only remove the symbolic link in the OneDrive folder and the files from the OneDrive web folder, and will leave everything as is in your D: \Josh\Desktop folder.
A few nice things about using Symbolic Links with OneDrive are;
- It allows you to backup ANY and ONLY the folders on your system you want to sync to OneDrive, not just the Desktop/Documents/Pictures folders.
- It lets you backup any folder without having to have your folder live inside your OneDrive folder, so you get to decide where your files live, not OneDrive!
Some more nice things about using Symbolic Links that can be used in general with Windows are;
- To Windows, the LINK looks exactly like a normal folder.
- You can pretty much create a Symbolic Link to and from anywhere on your local system and you can TARGET most remote paths like a network share.
- You could add new physical drives to your system and then create Symbol Links so that Windows looks at your new drive using the same path as your old drive, so you could virtually increase the size of a "drive" via folders and Symbolic Links .
- Once you get the hang of them, they can be VERY handy and you'll find all kinds of uses for them.
- You should be able to use them to work around other special kinds of folders that can give you a local path like Google Drive, DropBox connections, etc.
- If you run your OS on a smaller NVMe or SSD C: drive, you could create a Symbolic Link to a larger secondary drive, like an external USB / Thunderbolt drive and have it appear as if its a folder on your C: drive, at most any location.
Note the /D command switch which tells the mklink program to create a Symbolic Link vs. the other link options the program has. If you want to take a deeper dive into Symbolic Links, their related kin JUNCTIONS, and the other command switches, check out this thread I came across while doing my initial learning about Symbolic Links. They have some nice charts to help spell out the pros and cons of the other options, but Symbolic Links are the most up to date version on Windows pretty much these days and are fairly simple to work with.
If you get to where you really start to use Symbolic Links a lot, there is another useful command to list all of the different Symbolic Links (and Junctions, the other type of links) on a specific drive. Use the command below and specify the drive you want to check at the end.
Code: Select all
dir /AL /S c:\
Thanks! - Josh ![Very Happy :D](./images/smilies/icon_biggrin.gif)
Do. Or do not. There is no try.
Josh's Digital Downloads is come back online soon. Stay tuned. (soon is a relative term)
![Very Happy :D](./images/smilies/icon_biggrin.gif)
![Image](https://www.joshhuggins.com/playingnow/pn1.jpg)
Josh's Digital Downloads is come back online soon. Stay tuned. (soon is a relative term)