0

Manage Hard and Symbolic Links in Windows

Link Shell Extension is a great Windows extension that lets you manage both hard and symbolic links. For some time the NT file system has had POSIX style hard links and symbolic links. Links are a way for one file location to refer to another file in a different location and keep the redirection transparent to programs accessing the file or link. The tools that Microsoft has provided to manage links aren’t very convenient but this extension is!

Hard links have to be on the same volume (e.g. one partition on a hard drive). You can think of them as a named reference to the underlying data. If you make a hard link in one folder to a file in another folder you now have two names for the same data (e.g. c:\folder1\myfile.txt and c:\folder2\myfile.txt). You can edit that file by opening the file from either location. The number of references is tracked by the operating system and none of the names have any special priority. If you make a hard link to a file and then delete the original file the file still exists but is now only referenced by the new location. If both reference are deleted then the file is considered deleted.

A symbolic link works a little different. The file a symbolic link points to can be on a remote volume if you want it to. If a program opens the symbolic link it still edits the data of the original file, like a hard link. If the original file is deleted however the data is gone and the link now points to nowhere. Deleting the link itself has no effect on the original file.

There are also Junctions which are similar to symbolic links except they are for directories. You can read more at the link I gave above.

Hard Link Example

I’ll give you an example of how I have used hard links. For a while I was downloading a lot of live concert recordings from etree and other private sites. These are recordings from bands that allow taping at their shows.

The folders for each show have more or less standardized formats. For example a Grateful Dead show might be stored in a folder called gd71-02-20.sbd.miller.116617.flac16. Because of this structure storing every folder in one parent folder provides for convenient browsing by author and performance date. On the other hand each site typically has their own torrent file for the show. This is because they might include extra files, or a summary text file from a different place, etc. The actual flac files  are the same though even at different sites.

Occasionally I would want to upload a particular torrent at a site other than the one I got it from. To pay back someone who had uploaded something for me, for example. Or sometimes I had to download from two different sites to get the full set of files.

Perhaps it is easy to see why I might want two copies of the folder. One folder that would have all shows so I didn’t have to guess which site I got a particular date from. Another folder would have a series of sub-folders by site. Those sub-folders would also contain the site specific descriptive files and the torrent.

Hard links let me do that. The downloads were already sorted into sub-folders so I just went to F:\Trading\BySite\Etree (for example) and selected all of the sub-folders. I right clicked and selected the “Pick Link Source” item that the Link Shell Extension adds. Then I went to the folder F:\Trading\ByDate\ and right clicked there and selected Drop As… >> Hardlink Clone. Done! Two files for the disk space price of one.

Now I could browse by date and launch a torrent to share by going to the BySite copy and clicking the torrent. There is nothing I need to remember about this setup either. Once it is set up the operating system tracks everything from there.

Link Shell Extension is a great tool to have. Go to the site and scroll to the bottom to download.

Vince

Leave a Reply

Your email address will not be published. Required fields are marked *