Menu

Why Doesn’t Disk Cleanup Delete Everything from the Temp Folder?


After you’ve used Disk Cleanup, you probably expect every temporary file to be completely deleted, but that’s not actually the case. Files are only deleted if they are older than 7 days old, but you can tweak that number to something else.
                    sshot-2010-12-02-1-01-25-06
This is one of those tutorials that we’re showing you for the purpose of explaining how something works, but we’re not necessarily recommending that you implement it unless you really understand what’s going on.

Why Doesn’t Disk Cleanup Delete All Files?
The applications that you’re running create temporary files, not to litter your hard drive, but to store files while the application is working on them—whether it’s downloading files, storing files that you’re currently editing, or just caching files so the next time you open the application the files will be more quickly accessible.

The problem is that most applications don’t seem to clean up after themselves, or if they do, they definitely don’t do it very well. That’s why your temporary folder gets really huge over time, and needs to be cleaned out.
                          
Since these files are often being used by applications, Windows doesn’t know whether a particular file can be deleted, so Disk Cleanup only cleans up files that are older than 7 days, which is a safe guess—most people probably don’t have an application open for more than a week, especially since Microsoft makes you reboot nearly every Tuesday, right?

You can even see in the screenshot that Disk Cleanup explains this to you, if you select the Temporary files option in the list.

Change Disk Cleanup to Delete Files Newer than 7 Days
If you’re one of those people that reboots your PC every day, you can probably change the Disk Cleanup value down to something lower, like 2 days. If you don’t reboot but you rarely keep applications open, you could probably do fine with 2-3 days instead, though the value you choose is really up to you—just keep in mind applications need those temporary files if they are running.

Open up regedit.exe through the Start Menu search or run box, and then browse down to the following key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
       CurrentVersion\Explorer\VolumeCaches\Temporary Files

Once you’re there, you’ll see the LastAccess value on the right-hand side, which contains a value that specifies the number of days, which you can change to whatever you’d like.
                          
If you want to see the results of your changes, you can open up your temporary folder by entering the following into the Windows Explorer location bar:
    %temp%
                        
And again, if you’re an average user, you probably shouldn’t mess with this registry value—but at least you know a little more how it works, right?

No comments:

Post a Comment