If you’re a Linux (or even a Mac) command-line person, you’re probably already familiar with the concept of filesystem links and the “ln” command. In short:
- A file is really just a collection of information on your hard disk.
- A directory entry is just a kind of pointer with a name that points to the information on disk.
So far, so good. Here’s the point that most don’t realize:
- There’s nothing wrong with having more than one directory entry point to the same information on disk.
In other words, the same file (or folder) can appear to be in two places at once.
What most folks also don’t realize is that Windows has the same capability as part of the NTFS filesystem; it’s just been under-advertised.
Here’s a practical example. I don’t like that OneDrive strongly insists on using “c:\users\<loginname>\OneDrive”. I much prefer to have my OneDrive folder at the root of my C: drive, as in “C:\OneDrive”.
So, in a Windows Command Prompt (run as administrator) I navigated to C:\, and then entered:
mklink /D OneDrive C:\Users\lnote\OneDrive
This created C:\OneDrive, which is a symbolic link1 to C:\Users\lnote\OneDrive. Either can be used interchangeably, almost any time I need to reference the contents of my OneDrive folder. Now it appears at the root of my C:\ drive, alongside my “C:\DropBox” and other similar folders.
Aside from my personal, somewhat anal-retentive need to have these folders at the root of my C:\ drive, you may find the whole concept of file linking, and the mklink utility, a handy addition to your command-line toolbox.
Related Video
Footnotes & References
1: Symbolic and hard links, and more nuances of the linking process, are beyond the scope of this simple tip. The take-away is simply that linking exists :-).
Leo
I’m sure this is good stuff, but as a Windows-only user I know about Folders, Files and Shortcuts.
Is a link just another name for a shortcut ?
Regards
Warren Crawford
In this context, no … a shortcut and a link are two different things. A link is a property of the file system on the hard disk (formatted NTFS for example – old FAT file systems did not support links). A shortcut is a special construct understood by Windows, regardless of how your hard disk is formatted.
The “quick-&-dirty” description is that a link works much like a shortcut — only more VERY MUCH more so: links must be used with real CARE! A link acts as an actual “copy” of the file or directory linked, but with only ONE source. As far the filesystem is concerned, the link IS the file or directory. Among other things, this means that it is possible to DELETE a file or directory by deleting its link (though this is thankfully a tad harder to do than it sounds). This type of functionality is quite powerful, and really useful when it’s needed — the issue being, that it’s almost never needed! In the vast majority of cases, there’s really very little a link can do that an ordinary shortcut can’t. If you insist on using links, research them carefully so that you’ll know what the h*ll you’re doing!
Thanks for sharing this additional info.
Knowing that it’s NTFS-specific makes it even more likely that I would use it.
I will stick with shortcuts for my needs.
I think shortcuts are also something that are under-understood by most users but extremely useful.
Cheers!
It would be interesting to have an article on how links and libraries are similar or different.
Given that Microsoft is deprecating Libraries I’m not sure there’s a lot of long term value there. Libraries simply confused the heck out of too many people. Just what are Windows 7’s “Libraries” and how do they work?