All I wanted to do was sit down, watch some Andromeda episodes, and drink my Monster Energy drink. Windows 7 decided to be confusing and kill 10 minutes of my time reading about the NTFS file system though, so I thought I’d blog about my findings.
It all started when I wanted to access My Videos. I went into my Documents “Library” in Windows 7, clicked on My Videos, and got an access denied error. Then I went in a little deeper and found,
C:\users\PherricOxide\Videos\ really exists.
C:\users\PherricOxide\My Videos\ is what’s shown in Explorer. This works when clicked.
C:\users\PherricOxide\My Documents\My Videos\ gives an access denied error.
The explanation? NTFS Junction Points. It’s a type of Reparse Point like symbolic links to files or mount points. In simple terms, a shortcut to a directory. This isn’t the same as the Windows Shell Shortcut though, like you would create with a new -> shortcut button. Junction points act entirely like the directory they point to.
For example, Vista and Windows 7 have a Junction “C:\Documents and Settings\” which points to “C:\users” to add legacy support for old applications now that the user data has been moved to a new location. If you move a file foo.txt into “C:\Documents and Settings\PherricOxide\” it will really move it into “C:\users\PherricOxide\”. This allows older applications to read, write, and modify files inside “Documents and Settings” without ever knowing it doesn’t exist anymore. Nifty, huh?
Now the odd part is the “Access Denied” messages when you try and access a Junction inside Vista or 7. The reason for this is that the file permissions are set so that you can’t list the files inside the these Junction/Directories. If you change the permissions or take control of the junction you can, but I wouldn’t advise it, because this is actually a feature and not a bug. The reason is that programs like virus software, backup software, or anything else that scans your entire drive likely wouldn’t realize they are traversing a junction. Using the above example during a virus scan, the scanner would scan both “C:\users\PherricOxide\foo.txt” and “C:\Documents and Settings\PherricOxide\foo.txt” for viruses, and waste quite a bit of time. To avoid this, permissions have been set up so all the Junctions in Vista and Windows 7 can’t be opened and listed, but the files inside can still be modified if you know the exact path to them.
- To view the junctions with the command prompt, you can run dir /aL in a folder. This is also the easiest way to see where a Junction points. Just a normal dir won’t show them.
- To view all the junctions in your computer, dir /aL /s > c:\JunctionsList.txt
- Someone finally came to their senses and got rid of all the My this and My that crap in the file system, plus spaces in tons of file names, yay! Unfortunately for the user, they still think they see it all, due to collections of junctions, symlinks, and Libraries for reverse comparability and new features.
- In Windows Explorer, Junction points are indicated with an arrow icon
- Deleting a Junction in Windows Vista and 7 is usually safe, but in XP or 2000 will likely delete the contents of the folder that the Junction points to.