Extra 4 Introduction to Folder Soft Links (Directory Links)
Appendix 4: Introduction to Folder Symbolic Links (Directory Junctions)
Symbolic links, judging by their name, share some similarities with hard links—for instance, both are links. In fact, they also go by another name: directory junctions. This type of link applies only to folders, not to individual files. While symbolic links have some common ground with shortcuts, the differences are significant.
The essence of a symbolic link is relatively straightforward. Here’s a typical use case:
In the root directory of drive D, there is a folder named test. So, its absolute path is D:\test.
Select this folder, right-click, and with Link Shell Extension installed, choose “Select Link Source.” Then, navigate to any location on your computer (e.g., C:\users\%username%\desktop), right-click again, and select “Create as” -> “Directory Junction.” This creates a symbolic link for the folder.
Now, click to open this newly created directory junction. What do you notice?
Looking at the address bar of this directory junction, we see that its location is on the desktop, not in drive D.
This is the key difference between a directory junction and a shortcut.
A directory junction behaves as if the folder from drive D has been moved to the destination we chose. However, in reality, creating a directory junction involves no file movement, copying, or pasting—just like a shortcut.
Using directory junctions, we can trick software on our computer. Consider this scenario:
“Genshin Impact” is a game developed by miHoYo. Before playing, the game requires downloading approximately 40GB of resource files. If we’re not careful, these files end up in drive C. If this unfortunate event occurs, drive C loses 40GB of precious space. Is there a way to “trick” Genshin Impact into moving those 40GB to drive D while pretending they’re still in drive C?
Here, we use folder symbolic links.
We simply move the 40GB folder to drive D, then create a directory junction at the original location in drive C where the folder used to be. Problem solved.
However, note that the name of the directory junction folder must match the original folder name used by Genshin Impact; otherwise, the game won’t be able to find or read the files inside the junction.
In essence, this operation happens at the file system level, and it’s transparent to both the user and the application. So, Genshin Impact genuinely believes its resource files haven’t moved and are still in drive C.
Additionally, it’s easy to understand that since a directory junction is still a link, any modifications made to files in either the original source or the junction will be synchronized. If we delete a file from the junction, it’s also deleted from the original source. (Remember hard links? Deleting one hard link doesn’t affect the others!)
This is akin to managing the same folder’s files from a different location.
So, here’s a question for you: what happens if we move an entire directory junction to another location?
Answer: The files in the original source and the original folder itself will be moved entirely to that new location!
Thus, it truly feels like “managing a folder’s files from a different place.”
Applications of Directory Junctions
From the “Genshin Impact” example above, it’s easy to see the applications of symbolic links.
A key use case is moving files across drives without changing their perceived location in the original drive.
By “tricking” the operating system and applications in this way, we can reduce drive C’s space usage.
Another example: drive C contains a folder with backups of all hardware drivers on the computer. We rarely use them, and they take up valuable space in drive C. So, we move this folder to drive D, create a directory junction at the original location in drive C, and rename the junction to the original folder name. This effectively reduces drive C’s footprint.
You can also apply this method to other large files in drive C that can’t be moved or are restricted from being placed on drive D, or to large software originally installed on drive C. If you encounter issues where the original folder in drive C can’t be deleted or some files can’t be moved, try performing the operation from within the PE system.
However, for essential software like Office, which is about 2GB in size, I tried moving its program folder to drive D and creating a directory junction in its place. Office then reported a configuration error and refused to run. I’m not sure why—perhaps it’s some Microsoft wizardry! Moving the folder back to its original location didn’t fix the issue either; it seemed irreversible. I had to reinstall Office. So, please don’t attempt to move Office—I’ve already tested it for you.