September 25, 2006

Slinky links

On the track of deleting traces of my old Vista install and re-installing Windows XP, I ran into some interesting information. It appears that Vista (and XP before that) has the ability to create symbolic links, or, as they are more commonly known in Linux circles, symlinks 🙂 No, I don’t mean those dreary old shortcuts, I mean real symlinks which are tied to the file system :p

Here’s how it all came about. I started deleting all the dreck left over from my Vista upgrade install prior to installing XP. In the process, I ran into certain folders which just would not delete – even when I had assigned all permissions/ownerships to my user account. I was completely puzzled but left the issue till later and went ahead with my XP install. However, once XP was up, I went back to trying to delete these odd folders and they still wouldn’t delete. Somewhere in there, in between pulling my hair out in frustration and doing a gazillion Google searches for the answer, I happened to do a directory listing in DOS and it listed these strange, non-deletable folders as junctions instead of directories. The light suddenly went on as the clue-dart hit me squarely between the eyes :p

Now I had known about NTFS streams (another really nifty but way underused file system feature), way back when they were introduced. But I had not known that NTFS had the capability to add junction points even though the ability had been there in both Windows 2000 and XP! Further reading led me to the Systinternals tool named Junction, which allows you to create and delete junction points. I used the tool to delete most of the junction points which were giving me trouble and was finally able to get rid of all the extra folders left over from the previous Vista installation. I later discovered a few other shell extensions which let me do the same thing from within Windows Explorer itself – NTFS Link Shellextension, Junction Link Magic and NTFS Link.

But what’s the use of all this extra stuff when Windows itself doesn’t support it, would be the question, right? 🙂 Well, I came up with one use almost immediately. I normally have all my data on a separate partition so that I can wipe the OS partition and reinstall everything without losing any data. But one thing which bites me all the time is the fact that most of my account specific data goes in C:\Documents and Settings – especially the My Documents folder. Sure, I can use TweakUI and set the My Documents folder to a different location. In fact, that’s how I used to do it till now :p But the issue with that is that sometimes, certain apps will still go to C:\Documents and Settings\Fahim\My Documents (or wherevere your documents folder is) instead of going to where My Documents has now been re-pointed to (usually on D drive). With junction points, I can simply set up the C:\Documents and Settings\Fahim\My Documents to point to my D:\My Documents folder and everything would go to the correct place! And that’s exactly what I did. Ah, the joys of discovering something new :p