Hardlinks are file-system level directory entries -- thus each file has at least one hardlink. To create a new hardlink, the syntax is:
Code: Select all
fsutil hardlink create <linkName> <targetName>
I often use hardlinks to create multiple filenames in the same directory. For example, when testing my xhtml files, my webserver serves them as application/xhtml+xml if the file has a .xhtml extension, and as text/html when the extension is .html. I can use hardlinks to save effort when I'm testing in Mozilla and Internet Exploiter (which doesn't understand the xhtml mimetype);
Code: Select all
fsutil hardlink create testFile.xhtml testFile.html
Hardlinks can only be used to link between files, however, which is a bit of a bummer if you've got a directory full of files to link. Junction points to the rescue! Windows 2000 doesn't have the necessary kit to create reparse points (on which junctions are based) out of the box, but there are freeware utilites that will do the job perfectly, like this one. Put it in System32 for convenience. The syntax is easy:
Code: Select all
junction <hostDir> <targetDir>
I could use a junction point to share my divX files, like so:
Code: Select all
junction "E:\DivX Files" "E:\Documents and Settings\My Username\My Documents\My Videos"
Hardlinks and reparse points are fairly similar. Both are completely transparent to applications, so all the erratic behaviour that you get with Shortcuts is gone. However, whilst with a hardlink, a file is not deleted until all the hardlinks are gone, with a junction, the files are gone as soon as the junction point is deleted, and all your junctions that pointed there will be left dangling. That's a gotcha and a half, so be careful, and since deletions and modifications to a junction are mirrored at the junction point, set ACLs appropriately to safeguard your data.