Make Windows Disk Cleanup Work Better

Windows systems and programs create and use a lot of temporary files. Unfortunately, Windows is not always a good housekeeper and lets these “temporary” files accumulate. You might be surprised at how much stuff your system picks up over time. Some PC users may prefer to use a program like CCleaner to keep things neat but there is something to be said for keeping the system simple and using the built-in Windows accessory Disk Cleanup.

Windows Disk Cleanup of temporary files can be improved with a configuration change. A previous tip showed how to speed up Disk Cleanup in Windows XP and this tip will show how to make Disk Cleanup more thorough in all versions of Windows.

By default, Disk Cleanup only erases temporary files that are older than 7 days. If you do not want files left behind for that long, this setting can be changed to a shorter time with a Registry edit. (Before doing any Registry editing, be sure you understand what is involved. For example, see this tutorial.)  

Editing the Registry to reduce time temp files are kept

Open the Registry editor and go the key:

   Explorer\VolumeCaches\Temporary Files

  1. In the right pane, right-click the entry “LastAccess”
  2. Choose “Modify”
  3. A dialog box similar to the figure below will open
  4. Enter a new value, such as 2, which will set the number of days that temp files are kept
  5. Click “OK”
  6. New value will take effect after a reboot

Modify Registry value

Registry file for painless Registry editing

If editing the Registry manually does not appeal to you, I have uploaded a Registry file that will do the job for you. Go to this page to download a zipped REG file. This particular file will reduce the time that temp files are kept to two days.  It can be used for Windows XP/Vista/7. Be sure to back up your Registry before applying any changes.

More information about Disk Cleanup

I have discussed Disk Cleanup for Windows XP in some detail at this link. A related discussion for Windows Vista/7 is given at this link.

Using the command line

The command line can be also used for a quick cleanup of temp files. See the following companion tip.

Get your own favorite tip published!  Know a neat tech tip or trick?  Then why not have it published here and receive full credit?  Click here to tell us your tip.

This tips section is maintained by Vic Laurie. Vic runs a Windows blog called The PC Informant and also operates a computer education website.

Click here for more items like this. Better still, get Tech Tips delivered via your RSS feeder or alternatively, have the RSS feed sent as email direct to your in-box.

Share this
Average: 4.5 (26 votes)
Your rating: None


by fiddler (not verified) on 1. August 2011 - 2:01  (76648)

How can one clean up 'ghost' files; the ones that sometimes appear as empty icons on the desktop that you can't trash because the computer can't see them (odd that it can't see them but it can show them.)

by sunsmasher (not verified) on 31. July 2011 - 20:43  (76633)

Not sure what the point of this article is when CCleaner works so well.

by AJNorth on 31. July 2011 - 17:44  (76624)

My personal preference remains CCleaner (with CCEnhancer).

It has been my experience in over a decade of using CCleaner that what problems may arise are almost exclusively related to its Registry cleaner, which I generally advise clients NOT to run (except, of course, for files unintentionally deleted by not having carefully configured CCleaner - which default settings are generally quite safe).

by gruff on 31. July 2011 - 16:01  (76616)

P.S. -- In the emails I get from TechSupport each day there are two URLs. One is linked to the title of the article and the other is a copy & paste URL in the body of the article.

In today's email, the active link tied to the article TITLE, takes me to a different location and a pop-up window asks me if I want to subscribe. Since I'm already subscribed, I click on X and close it but I don't get to the article itself. I had to copy the URL to get there.

by ouman77 (not verified) on 31. July 2011 - 14:55  (76609)

Nice tip!
I've tried Ccleaner - but it eventually caused me more problems than it "fixed". But - as stated above - if you're nervous, don't mess with the registry. (but you'll never learn anything about it.)

by gruff on 31. July 2011 - 14:36  (76607)

I have a database of news articles that is 7 gigs deep. There are many duplicate files in this database as some articles fit into more than one category (folder).

My question is whether or not this program will delete those duplicate files I don't wish deleted?

More information: My root drive (C:) is where my OS (XP PRO) is. There is nothing else on this drive.

The database I speak of is on Drive E:. Does this protect the database? (i.e., does the duplicate file cleaner only affect drive C:?)


by v.laurie on 31. July 2011 - 14:57  (76610)
by gruff on 31. July 2011 - 16:03  (76617)

Thanks. I'd like to keep C: as clean as possible. But I don't want to eliminate the duplicate files on E:. If I understand you, Disk Cleanup will only work on C: Is that correct?

by v.laurie on 31. July 2011 - 16:19  (76619)

Disk Cleanup can be configured for whichever drives you prefer.

by Phill (not verified) on 31. July 2011 - 14:18  (76606)

Very Good Tip.

Would advancing the PC date 5 days do the same??

by B.Baker (not verified) on 1. August 2011 - 13:44  (76693)

Giggle - giggle.... Looks like V.Laurie didn't understand your question.

by v.laurie on 31. July 2011 - 14:53  (76608)

You can use the number of days that suits you best.

by postcard1 (not verified) on 31. July 2011 - 13:40  (76604)

If it's your first time attempting to use the registry and you have butterflies in your stomach, don't use it. Ccleaner may not be the best solution, but you'll have no butterflies in your stomach either. :)

by peng (not verified) on 31. July 2011 - 13:30  (76603)

I hate technical stuff because there are always more and more details and whenever I get them a little they change them anyway.

Like an neighborhood where as soon as you learn how to get around a little they twist the streets around so you're lost again.

by peng (not verified) on 31. July 2011 - 13:26  (76602)

Very complicated for a non-technical type like me. It's easy to use ccleaner instead.

I have no idea what your're writing about re the registry, whatever that is!

by ixan on 31. July 2011 - 13:02  (76599)

Is this better than using Ccleaner?

Gizmo's Freeware is Recruiting!

Gizmos Needs YouShare your knowledge of free software with millions of Gizmo's readers by joining our editing team.  Details here.