Why You Need to Clean Up Your Temp Directory?

by windowsiso on November 5, 2012

I’ve seen so many error messages similar to the one below that turned out most of them are caused by a very crowded TEMP directory that holds up not only junks but incompatible craps as well that never seemed to go away.

Application Error

And majority of the time, they can be solved by a much more cleaner TEMP directory. For starters, the TEMP directory I am talking about here is located in individual user profile, more precisely, they are at:

%userprofile%appdatalocaltemp

If you go there from windows explorer, don’t be surprised by what you are going to see. Currently, there are over 600 items with more than 20 sub-directories laying there. It could be worse in yours.

But why it’s the cause for the errors like shown above?

For that particular case, referred by Raymond’s The Old New Thing,

The error code 0xc00000ba is STATUS_FILE_IS_A_DIRECTORY, which means that something was supposed to be a file, but instead it was a directory. The path-searching algorithm is not a backtracking algorithm, so once it finds something wrong, it just stops rather than backing up and trying the next directory.

And deleting those fake folders that have a file name in the TEMP folder fixed the errors like this. Raymond goes a bit further explaining:

The TEMP directory is a dumping ground of random junk. A downloader may have put a DLL there and forgotten to delete it. (Or worse, expected it to stay there forever.) And that DLL might be from an incompatible version of some DLL your setup program uses. (I have seen applications ship their own custom versions of system DLLs! Yeah, because the x86 version of shlwapi.dll from Windows 2000 is drop-in compatible with the version of shlwapi.dll that comes with Windows 7.) Who knows what other yucky things have been lying around in that directory. Since the application directory is the first directory searched when the system looks for a DLL, a rogue DLL in the TEMP directory is a trap waiting to be sprung. (A similar issue applies to a shared Downloads directory.)

Since, we have little control over to the bad programming, it’s easier and important that we keep our own house clean to stay away from them.

To do so, you can simply run the Windows built in Disk Cleanup utility periodically by pressing Win key, typing “Disk Cleanup”, and it can be easily identified by the search list. And of course, you can always directly head into the TEMP folder and do a purging work there if you want to.

Disk Cleanup - temporary files

Related Articles From Windows7hacker:




Previous post:

Next post: