An interesting feature in Windows XP (probably in 2000 as well) that many people probably don't know of, is NTFS junctions (and for those that do know about them, most probably don't use them). MS finally added support for symbolic links in Vista, though not everyone uses Vista at the moment. On the other hand, Linux has had symbolic links for ages.
What are Junction points?
In a nutshell, it's basically a folder alias. For example, if you have a directory at C:\mydir, you could create a junction (assuming D: is an NTFS drive) at D:\link which directly links to C:\mydir.
How is it different from shortcuts?
Whilst it may look like a shortcut, it's actually a bit different. A shortcut is actually just a file (with a .lnk extension (which is usually hidden)) which tells
explorer (note, not any other application) to automatically redirect you to that location. Note that it's a redirection, not an alias. And being a file, you can actually open the shortcut in a hex editor and view the contents of this ~1KB file.
A junction point, on the other hand, being an alias,
acts as the linked folder. For example, if you have a subfolder C:\mydir\subdir, the directory D:\link\subdir will exist. If you save a file as D:\link\subdir\myfile.txt, the file C:\mydir\subdir\myfile.txt will exist.
Junctions vs Symbolic links
Basically, junctions can only link folders, whereas symbolic links can link files. In XP, you can perform hard links for files, however it'll only work if the link and the file are on the same drive. But junction points are usually enough for most purposes.
How to make Junctions
Before wee continue:
Be careful when dealing with junctions, primarily with regards to delete operations (also be aware of rename/move operations). Avoid simply deleting a junction point - many applications won't be able to tell it's a junction point, so it will clear everything inside your juction along with the junction (even if that's what you want to do MS recommends to avoid doing this). Also, deleting the source folder of a junction could leave you with a hanging link, which may or may not be hard to deal with. Similarly, if you move/rename the source directory, a similar thing could happen.
When removing a junction, please do it the proper way (will show how). If you want to remove the source folder, remove the junction first, before removing the folder.
Now here's the tool I used to create junctions - it's a command line app, but simple enough to use (there are probably GUI apps around if you look for it):
http://technet.microsoft.com/en-us/sysin...96768.aspx
To create a junction, the following command will do the job:
for example
To remove:
ie
Uses for Junction points
Right now, it may seem junction points are an interesting thing, but doesn't have much practical use. I'll admit it's not something you'll probably use on a daily basis, but it does have some interesting applications - here's some ideas:
- Quick fix for out of space partition - let's say you have a system partition C: and a file storage partition D:. You're low on space on C:, but have plenty on D:. However, you need to install an application, which will write a lot of stuff to C:. Instead of resizing partitions, or trying to clear out C:, a quick fix is to move some of your apps installed on C: to D:, and then make junction points to link the applications back to C: - your apps will still work fine (since they'll appear to exist on the C: drive), and you'll have more space on your C: drive.
- Reducing fragmentation on "read-only" drives - like in my partitioning guidelines thread, I mentioned keeping the number of write operations to a system partition down to lessen/prevent fragmentation (and make your system drive perform optimally). This is especially more important if you're using an SSD, where writes are slow and wear down the drive. The simplest solution in this case is to simply junction the places where stuff is written to another partition/drive. For example, the Documents and Settings folder.
- Manual Preloading - junctioning can be used to perform this. Essentially, you load your commonly used apps directly into RAM (like Superfetch, but this is better since you have full control over what is loaded). I'll talk more about this in another thread.
- Tidiness? - if you like storing all your files on one drive/partition, and your apps on another, you may face some problems of apps saving stuff in their installation directory (ie games which save stuff to their /save folder). If you want to have the save files together with your other files (perhaps if you only back up your files partition - this ensures that all your files are backed up) then a junction point is a solution.
Tip: I typically stick a different folder icon for junctioned folders to indicate that the folder is a junction point and not just a folder, so I don't accidentally delete it some time later.
Fun with Junctions
Well, not really - unfortunately, Windows is smart enough to put some limits on things. One thing you can do is make a folder, then inside the folder, create a link back to its parent. This will give the effect of being able to constantly enter the same folder. Unfortunately, Windows limits the depth of this, but you could use this with folders with plenty of subfolders, to make searching incredibly slow (if your school admin likes searching your folder for stuff, perhaps).
Alternatively, if you can, stick a junction in your folder to C:\Windows, and watch him wonder why you can stick ~1GB of data on your 20MB drive and why he can't delete your stuff...