Redirecting Folders Created by Programs During Installation--How To
Friends: For years I have benefited from this forum without contributing. I thought it was about time that I return the favor. I don’t have the standing required to post a tutorial, so I’m making my contribution here. One of my great annoyances is programs that insist on creating folders in My Documents, my user folder, or in the root of my hard drive. If the program doesn’t provide a setting allowing you to change the location, deleting the folder just means the program will recreate it the next time you run the program. Below, I will walk you through how to redirect a folder that a program creates to a different location with no adverse impact on the functionality of the program. Following these steps, you can permanently relocate all those pesky folders that get created in my documents (MS Fax, Scanning folders, Adobe, etc) to wherever you want them to reside. The NTFS file system has an inherent feature called symbolic links (also called NTFS junctions). A symbolic link appears to Windows and any programs running in Windows as a real directory but is, in fact, a pointer redirecting the program to another drive or folder. Windows uses symbolic links to maintain backward compatibility. For example, in Windows 7, there is a hidden symbolic link in the root directory entitled “Documents and Settings” that points to the “Users” directory in order to maintain backward compatibility with programs written for XP (turn off “Hide Protected Operating System Files” in Folder Options and see for yourself—after looking, don’t forget to turn it back on!). By creating symbolic links and then hiding the pointer file, you can make ill-behaved programs behave. Here’s How:
- (Optional) For those folders with content you will never need to access, create an out-of the way parent folder in which you will keep all of them. For example, I created a folder entitled “Redirected” in my AppData directory (Note: The AppData folder is hidden. To make it visible, go to Folder Options, View and select to “show hidden files, folders, and drives”)
- Go to www.sysinternals.com and download the Junction application (Note: Sysinternals has a plethora of great apps worth checking out). Save the executable somewhere easy to find, like the root of your hard drive (i.e., “c:\”).
- Open an elevated command prompt. To do so, in the Windows Search box, type “cmd”. Right click on “cmd.exe” and select to “Run as Administrator”.
- At the command prompt, navigate to the directory in which you saved “junction.exe”
c:\Windows\system32> cd c:\
- Leaving the command prompt open, go to Windows Explorer and move the folder you want to redirect to its new location, making note of the full paths of its original and new locations. Note: To see the correct name of the path, click in the open space to the right in the windows path bar at the top of Windows Explorer. Unless you do this, you are not seeing the actual path. For example, the path for “My Documents” will initially display something like this:
► [YOUR NAME] ► My Documents ►
But, when you click in the open space, you will see the actual path:
It is the actual paths (like immediately above) that you need for the folder that you are redirecting.
- Back at the command prompt, type the following commands, substituting the original and new paths for “[ORIGINAL PATH]” and “[NEW PATH]”, but keeping the quotes:
c:\> junction.exe “[ORIGINAL PATH]” “[NEW PATH]”
c:\> Attrib +s +h “[ORIGINAL PATH]” /L
c:\> junction.exe “c:\Users\Steven\Documents\Adobe” “c:\Users\Steven\AppData\Redirected\Adobe” [ALL ON ONE LINE]
c:\> Attrib +s +h “c:\Users\Steven\Documents\Adobe” /L
The first command creates the symbolic link to the new location. Note that this command will fail if the folder still exists in its original location, because this command needs to create a link with the exact same name at that same location. Likewise, the command will fail if the folder does not exist at the new location, since the symbolic link is beng configured to point to this location. This is why you must move the folder to its new location before running the command.
The second command makes the symbolic link a hidden system file so that you won’t see it even if you have selected to “show hidden files, folders, and drives”. The only way to see the link is to uncheck “Hide protected operating system files” in Folder Options—something you shouldn’t ordinarily do.
- Repeat steps 5 and 6 for every folder you want to relocate. Your programs will never know you moved them, and you’ll be a lot happier!