Sunday 18 February 2018

windows 7 - Reclaim home directory


The home directory is where a user is supposed to keep their personal files, for example documents and music. On my computer this is


C:\Users\Steven

also known as the %USERPROFILE% variable. The problem is that any program you install has access to this variable and can create files and folders inside this directory. So over time my once neat folder becomes junked up.


I have dealt with this problem by creating a folder


C:\Steven

to store by personal documents and music, but this just seems wrong. I would like to put my documents where they are supposed to go, and have programs put their junk files and folders elsewhere, is this possible?



Answer




The home directory is where a user is supposed to keep their personal files, for example documents and music.



Yes, it is supposed to be for that.



The problem is that any program you install has access to this variable and can create files and folders inside this directory. So over time my once neat folder becomes junked up.



Indeed. Some programs will store user-specific settings files for that program in there which makes sense because these are your settings. Moreover, by keeping your settings in your folder, you can back them up and copy and restore them as needed so that if you re-install the program, you don’t have to re-set everything from scratch.


Unfortunately, some programs are extremely poorly written and will keep all kinds of extra junk in there which they have no business storing in a user’s personal folder. I have seen programs (e.g., from Macromedia—now Adobe—as well as Microsoft, tsk, tsk) which store hundreds of megabytes of help files and documentation in there. ‽ Even Google does this with Chrome, it stores the entire program with all of its hundreds of megabytes of program files in the user folder.


There is absolutely no reason to be doing stuff like that. Not only does it clutter up the user folder, but it also bloats and complicates backups. You have to either waste space to include them in a backup of the user folder, or you have to use a file-level backup program that lets you exclude them all.


You could try filing a bug-report and complaining/explaining the problem and hope they fix it, but that probably won’t happen.



I have dealt with this problem by creating a [different] folder to store by personal documents and music, but this just seems wrong. I would like to put my documents where they are supposed to go, and have programs put their junk files and folders elsewhere, is this possible?



Sadly, no. If you put your personal files where they are supposed to go, that is where the system is designed to put them by using variables and such, then programs which are coded to use those variables can and unfortunately will put files in there.



One solution, or more accurately work-around that I have been using for years is to take advantage of the fact that Windows has multiple links to the user folder. In addition to the root user folder (%userprofile% = C:\Users\foobar), Windows also has pointers to several “special folders”. One of these is your My Documents folder, which is meant to serve as the primary location for your personal files (which many users assume is what the root user folder is for).


Most programs will keep their stuff in the AppData and LocalAppData folders in the user folder, not in My Documents. Therefore, what you can do is to leave the root user folder alone and let programs write your program-settings and their own junk in there, while redirecting other, more relevant folders.


The best part is that in addition to being able to change the location of your My Documents folder, you can change the location of a whole bunch of different folders.



For example, I have been using a setup similar to the following in XP/7 for years:


UserProfile → D:\Users\Foobar
Personal → E:\DataFiles
Desktop → E:\DataFiles\Desktop
Favorites → E:\DataFiles\Favorites
History → E:\DataFiles\Logs\IEHistory
Recent → E:\DataFiles\Logs\Recent
Music → F:\Music
Videos → F:\Videos
Cache → G:\Temp\IECache
Cookies → G:\Temp\Cookies

This has several beneficial effects:




  • The root user folder is moved to another drive. I do this for all users, but you can do it for a single user, or not at all. I prefer to keep all user folders on a different partition because it makes it easier to backup and restore them (e.g., taking a drive-image without wasting space for Windows system files), as well as making it easier to re-install Windows without affecting user files.




  • It moves my My Documents folder to a different partition where I keep all of the files that I create myself and which are thus irreplaceable. This makes it easy to back them up without wasting space because I can keep them all on a much smaller partition and clone the whole volume. It also makes it easy to store your personal files on removable-media like a flash-drive if you want to (though that has its own risks, like what happens if you forget to plug it in before booting up?)




  • It stores large media files like music and video in a different partition where I keep all of my media files. These are usually expendable files which are not irreplaceable, so I wouldn’t want to waste space by including them in backups of personal files.




  • It gives me better control over things like logging by putting histories and such with other log files.




  • It lets me keep temporary files in their own partition (I also redirect the temp and tmp environment variables to point to that drive, e.g., G:\Temp\Temp). That way I can clear out all temporary files very easily instead of having to dust every nook and cranny of the system.




This will usually work just fine and without issue. It’s possible that a program could be very poorly-designed has has hard-coded paths and thus expects certain files and folders to be in a specific location, but such programs are exceedingly rare, especially for the past decade or so. (I have yet to run into such a program, even though I have used truly ancient programs including one that couldn’t work if the system had more than 1.5GB of combined physical+virtual memory.)



You can redirect most special folders by using the Location tab of their Properties dialog (figure 1). Not all of them can be moved like that, so you’ll need to change them through the environment-editor for those that have a dedicated variable like userprofile and temp, or to use a program like TweakUI for XP (figure 2) or Special Folders Manager for Vista+ (figure 3), or manually edit them in the registry (figure 4).


You will still have junk accumulating in the root (under AppData and LocalAppData), but by moving the stuff you care about, you don’t have to worry about the root user folder anymore and can stop by once in a while when you have a few minutes of free time and take a look around to see what you can weed out.




Figure 1: Screenshot of Location tab of the My Videos folder:


Screenshot of Location tab of My Videos folder


Figure 2: Screenshot of Special Folders in TweakUI


Screenshot of Special Folders section of TweakUI


Figure 3: Screenshot of Special Folders Manager


Screenshot of Special Folders Manager


Figure 4: Screenshot of User Shell Folders in the registry


Screenshot of User Shell Folders registry entries


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...