Found a hidden feature or want to share a time-saving shortcut? Let us all know...
#81768 by joshhuggins
Wed Nov 30, 2022 1:46 am
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.

Code: Select allmklink /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 allsymbolic 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 alldir /AL /S c:\
#81771 by joshhuggins
Thu Dec 01, 2022 12:15 pm
John Daglish wrote:I have had success using the Link Shell Extension which does the same thing Symbolic Links, Hardlinks, Junctions, Volume Mountpoints, ... without having to dive into DOS on my Windows 7 OS.
I note latest example is used with Windows 10.
https://schinagl.priv.at/nt/hardlinkshe ... nsion.html

Nice! :D

Who is online

Users browsing this forum: No registered users and 7 guests

About DataCAD Forum

The DataCAD Forum is a FREE online community we provide to enhance your experience with DataCAD.

We hope you'll visit often to get answers, share ideas, and interact with other DataCAD users around the world.

DataCAD

Software for Architects Since 1984