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 successfully (?) set up a junction link between the cache folder used by Iron browser to point to another folder on a ram drive, yet when I view the contents and size of both folders they are identical.I was under the impression that a junction would "force" or re-direct a program to utilize the target and not the source. What gives? Why are both folders identical and how do I know if the program is actually using the target folder?

share|improve this question

1 Answer 1

  • "Why are both folders identical?"
  • "But why are both folders full of the same identical files?"

I am under the impression you don't have a clear concept of what a junction is.

When you create a junction, you are not actually creating a new folder. It's just a "shortcut", roughly speaking, to an already existing folder. Every action in one folder happens on the other folder, because it's a junction.

They are not 2 different folders. It's the same folder, with two different names and/or paths. Imagine a house with two different doors. The rooms inside and the stuff inside the rooms are the same. Right?

The folders are, as you say, "synced", because of this: they are actually the same folder. If you delete all the files from a junction, the original folder will be empty. For the same reason, a junction doesn't take up more space on the drive.

See the explanation about Hard links and junction links on the Microsoft MSDN:

A hard link is the file system representation of a file by which more than one path references a single file in the same volume. (...) Any changes to that file are instantly visible to applications that access it through the hard links that reference it. (...) However, the directory entry size and attribute information is updated only for the link through which the change was made. (...) A junction (also called a soft link) differs from a hard link [because it link] directories [instead of files, it can even link] directories located on different local volumes on the same computer.

  • How can I create a junction?

mklink /j junction originalfolder where "junction" is the name of the junction being created, and "original folder" is the name of the folder it will point to. (note the original folder has to exist and the junction has to not exist).

  • How can I know if a folder is a junction?

dir /a should give a result containing <JUNCTION> on the correspondent line.

  • How can I removea junction?

use rd to remove it like a regular folder

Note: if you remove the original folder, the junction will still be present, pointing to nowhere and returning an error when you try to open it.

share|improve this answer
    
Thanks for the explanation...I figured out the link works via "shortcut" properties and "open file location", however I still get both folders full of the identical files. I thought that the source folder or file of a symbolic link did not have any activity at all other than "redirect" the call. Why do the folders appear synched? –  user190184 Jan 15 '13 at 20:36
    
Please check my improved answer –  That Brazilian Guy Jan 15 '13 at 21:06
    
Therefore if the program (in this case the browser) "calls" for the cache folder it REALLY is going to the folder which the junction is pointing to,right? I still don't get why the source folder doesn't "take up any space" when explorer hows that it is. Never mind, I just re-read your post and I think I get it, it seems strange to me that Windows would "seem" to show that both folders have the same data. It should show something "different". Maybe that can be part of Windows 9 or Windows 8 upgrade ....:) –  user190184 Jan 16 '13 at 1:48
    
@user190184 "it REALLY is going to the folder which the junction is pointing to,right" -- No, it is going to BOTH, because they are the SAME. Suppose you have a car with doors on the front and the back. If you open the fron door and see Bob is in the car, then you open the back door and see Bob in the car, how can it be? It's different doors? Well, both doors lead to THE SAME CAR. SAME contents. See? –  That Brazilian Guy Jan 16 '13 at 1:59
    
Also, please don't make repeated comments. –  That Brazilian Guy Jan 16 '13 at 2:00

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.