Tuesday, July 21, 2015

Cleaning Windows 10 TEMP Folder - Disk Cleanup or Delete ALL

This post examines is a detailed examination of Disk Cleanup for Temporary files in Windows 10.

Disk Cleanup for Windows 10 continues to perform the same way as previous versions in regards to deleting TEMP folders.

When you choose Disk Cleanup "Files to Delete:" category "Temporary Files", 

it refers to files in c:\TEMP and c:\Windows\Temp folders.

Before you read further, now's a good time to review my post on all the Windows 10 Disk Cleanup "Files to Delete" Categories. And a word of caution, removing some categories has irreversible consequences....


Disk Cleanup will only find and deleted if they are older than 7 days.






But what if you want to delete all the files now? 


One suggestion is to modify the registry LastAccess dword value from 7 (days) to 0 (days). There are two locations in Windows 10

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

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




Sounds like a great idea and I tried it. It did not work! I also tried all combination of Flags, but that did not work either.

After some long research, I have discovered why.

Simply put it Temporary Files calls dataclen.dll
to clean up the actual files, but this dll does not implement a IEmptyVolumeCache2 handler which respects LastAccess value.

If it implemented IEmptyVolumeCache2 we would see a View Files button beside Temporary files.


is missing for Temporary Files 


It only implements IEmptyVolumeCache handler, which does not respect LastAcess or Flags settings.

You can actually create your own Files to Delete category/handler to delete files you want
and is well documented at this Microsoft MSDN article entitled "Creating a Disk Cleanup Handler". 

In fact, each software app/ program should use this API to clean up their own mess, but they don't. Here's my post on Google Chrome being a pig with install files. Google should create their own "Google Chrome Installation Files" and "Google Chrome Temp Files" to clean up their own shit.


Final Solution

So in the end, if you want to delete all files in TEMP folder now you can do this

Enter these shortcut string into Windows Explorer location bar

%temp%
 for you 
appdata\local  directory
%windir%\Temp  for you windows\temp directory

and do the trusty select all (CTRL-A)  and DELETE.


If you need more information, please visit:








2 comments:

  1. Brilliant - this helped me solve my problem! Thanks :)

    ReplyDelete