Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have C:\HardDrive1\name\ and D:\HardDrive2\name. I want to make (at least read-only) access to these folders at I:\name (for example). Is this possible at Windows? Also I'm interested is there UNIX way to do it?

share|improve this question
    
windows 7 (and possibly vista) has symlinks. older windows has junctions. In this case, you might want to be specific about versions. –  Journeyman Geek Nov 11 '11 at 6:47

2 Answers 2

up vote 1 down vote accepted

In UNIX, symbolic links. Read the man page for ln (use the -s option). For Windows, use junctions.

share|improve this answer
1  
@ShyMan see also superuser.com/questions/67870/… which has all the most usefull links to the MS info. –  Psycogeek Nov 11 '11 at 6:49

On Windows 7 and Vista, there is the command line utility mklink to make symbolic links, for the rest, there's junction from sysinternals which creates so called junction points.

Some things to keep in mind:

  • Junctions and symbolic links are softlinks between two directories.
  • Never use recursive deletion tools to remove a junction (Windows 2000, XP), it will delete the files inside the junction first (thus deleting the real files). Use the tool rmdir to delete junction points.
  • If you delete a symbolic link (made with mklink, Windows Vista and 7), just that will disappear.

If you delete the real directory, the junction/symbolic link will be an empty directory from now on.

  • It is MANDATORY that both partitions be formatted as NTFS to make junctions or symlinks.

Usage:

First, create the folder(s) the junction(s)/symlink(s) will point to, in this example, I:\name1 and I:\name2. Junctions need an empty NTFS folder to point to!

C:\>mklink /d "I:\name1" "C:\HardDrive1\name"
C:\>mklink /d "I:\name2" "D:\HardDrive2\name"

Or, on XP using junction.exe

C:\>junction /d "I:\name1" "C:\HardDrive1\name"
C:\>junction /d "I:\name2" "D:\HardDrive2\name"
share|improve this answer
    
Problem is that I don't want create just two links I:\name1 I:\name2. What I really need is to access two (or maybe more) paths from same (virtual) path. Possible solution is to create link (junction) for every file (folder) from C:\HardDrive1\name D:\HardDrive2\name Z:\HardDrive1000\name in target directory I:\name. This is works perfectly. But this ugly hack IMO (In my case I need to create 100K links per drive). –  ShyMan Nov 11 '11 at 7:22
    
You can't point two junctions to the exact same folder. My suggestion is, just move the C:\HardDrive1 to c:\HardDrive1000 folders into one c:\HardDrives folder, and junction/mklink that. Now you need only one per drive, and you max out at 26 drives (A to Z) anyway –  sinni800 Nov 11 '11 at 7:24
    
@sinni, nonsense. You can point as many links - whether symlinks or junctions - as you want to the same location. (In the end, both are just reparse points containing the textual path of their target, no deep magic. Because of this, and the fact that disks can be moved physically, implementing such arbitrary restrictions is not only unnecessary; it's also impossible.) –  grawity Nov 11 '11 at 10:09
    
@sinni, also, it is not mandatory that the target filesystem be NTFS; symlinks and junctions are unidirectional pointers to an arbitrary textual path, and while they can only be created in NTFS, they can point to practically anything (symlinks can even point to network shares). –  grawity Nov 11 '11 at 10:17
    
@sinni, to clarify my first comment: one link can point to exactly one target, but one target can have any number of links pointing to it. –  grawity Nov 11 '11 at 10:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.