Create NTFS Junctions aka Directory symbolic links - gHacks Tech News

Create NTFS Junctions aka Directory symbolic links

I have been writing about the sweet little tool Junctions before but it got somehow lost among more popular articles back then and I decided to give it another try. A Directory Symbolic Link is a link from another drive or directory to an existing directory. NTFS Junctions can be used for instance to access the folder d:\mp3 from a symbolic link in c:\mp3. Basically,  you can access a folder on your hard drive from another location, like a virtual folder of sorts.

Junction was created by Mark Russinovich and is freely available on the Microsoft homepage. The software has a size of only 41K and can only be used from the command line. I'm using several NTFS junctions to be able to access my most important directories from several of my hard drives.

Let us take a look at the example from above and create a NTFS junction from c:\mp3 to d:\mp3. To create the junction you open the command line and write the following code: junction c:\mp3 d\:mp3. If the folder c:\mp3 does not exist it will be created by the command line tool.

You do not have to name them the same way. You could as easily create another junction that links from f:\music to d:\mp3 as well.

This is in my opinion a very nice way of being able to access folders from different hard drives easily. To delete a junction you use the code: junction -d c:\mp3

You should note that you can't use the root directory of a hard drive as the folder that you want to link to. You do need to specify at least one folder. It is also only possible to use junctions on ntfs hard drives.

Junctions are great for a number of purposes. From making a nested folder available in a better way to moving files from one drive to the other without losing any of the folders functionality.





  • We need your help

    Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

    We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats (video ads) or subscription fees.

    If you like our content, and would like to help, please consider making a contribution:

    Comments

    1. Terence Hill said on July 21, 2007 at 9:19 pm
      Reply

      Why do it with the command prompt?
      I think it’s better HardLink ShellExtension, you can use it for junctions, hardlinks, and symbolic links.
      http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html

      Hi

    2. fredden said on July 22, 2007 at 3:34 am
      Reply

      If you’re looking to what’s claimed not to work in the last paragraph, you should look at the “Disk Management” utility. It can mount an entire filesystem to a drive letter, or to a mount point within another mounted drive. Note: this method only works for entire filesystems. If you want to link just a directory, then use the Junction stuff above.

      On another note, why can’t one “Junction” a file? We’ve had this functionality as part of a standard build in Linux/*BSD for *years*.

    3. Martin said on July 22, 2007 at 9:15 am
      Reply

      Fredden you have to ask Microsoft the last question ;)

    4. AfricanBoy said on July 23, 2007 at 1:09 pm
      Reply

      Someone posts a nice tool for windows and some people just have to bring in a linux reference.

    Leave a Reply