{"id":4491,"date":"2016-11-01T17:44:34","date_gmt":"2016-11-01T17:44:34","guid":{"rendered":"http:\/\/198.58.113.91\/blog\/?p=4491"},"modified":"2023-04-26T13:05:29","modified_gmt":"2023-04-26T07:35:29","slug":"disk-cleanup-wipe-out-temp-folder-contents-completely-lastaccess","status":"publish","type":"post","link":"https:\/\/www.winhelponline.com\/blog\/disk-cleanup-wipe-out-temp-folder-contents-completely-lastaccess\/","title":{"rendered":"Why doesn&#8217;t Disk Cleanup Clear the Temp Folder Contents Completely"},"content":{"rendered":"<p>Disk Cleanup (Cleanmgr.exe) is a built-in tool in Windows that offers some useful cleanup options not available in other 3rd party cleanup tools. It can remove <a href=\"https:\/\/www.winhelponline.com\/blog\/delete-old-drivers-windows-update-disk-cleanup\/\">superseded device drivers<\/a>, Temporary Files, Internet Explorer cache, <a href=\"https:\/\/www.winhelponline.com\/blog\/windows-update-cleanup-disk-cleanup-windows-7\/\">obsolete Windows Updates<\/a>, <a href=\"https:\/\/www.winhelponline.com\/blog\/delete-windows-old-folder-previous-versions\/\">Previous Windows Installation (Windows.old) folder<\/a>, and much more.<!--more--><\/p>\n<p>But you may be wondering why Disk Cleanup skips deleting some files and folders in your TEMP folder and how to fix it.<\/p>\n<h2>Cause<\/h2>\n<p>When it comes to deleting Temporary Files, Disk Cleanup by default doesn&#8217;t wipe out items that match the following criteria:<\/p>\n<ol>\n<li>Files with Read-Only, System, or Hidden attributes<\/li>\n<li>Files which have been accessed in the last seven days<\/li>\n<li>Directories that have been created in the last seven days.<\/li>\n<\/ol>\n<p>For criteria 2: With a simple registry edit, you can make Disk Cleanup erase all Temporary Files or only the files whose last accessed timestamp is greater than &#8220;n&#8221; number of days from the current date.<\/p>\n<p><em><strong>RELATED:<\/strong> <a href=\"https:\/\/www.winhelponline.com\/blog\/delete-unused-files-older-than-x-days-windows\/\">How to Delete Files Older than N Days Automatically in Windows<\/a><\/em><\/p>\n<h2>Make Disk Cleanup erase all the Temporary files<\/h2>\n<p>Start the Registry Editor and go to:<\/p>\n<pre>HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VolumeCaches\\Temporary Files<\/pre>\n<p>In the right pane, double-click <strong>LastAccess<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4492\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/11\/temporary-files-clear-all-1.png\" alt=\"disk cleanup delete all temp files\" width=\"634\" height=\"256\" \/><\/p>\n<p>Set the value data for <strong>LastAccess<\/strong> to <strong>0<\/strong>.<\/p>\n<p><em>&#8220;LastAcess&#8221; value represents the number of days that must have elapsed since a file was last accessed or a directory was created for that file or directory to be considered for cleanup by Cleanmgr.exe.<\/em><\/p>\n<p>By setting the <strong>LastAccess<\/strong> registry value data to 0, you can force Disk Cleanup to clean up all the Temporary Files. It skips files that can&#8217;t be deleted &#8212; such as files that are currently in use by <a href=\"https:\/\/www.winhelponline.com\/blog\/find-process-locked-file-openfiles-utility\/\">applications<\/a>, and the ones you don&#8217;t have write access to.<\/p>\n<div class=\"qt\">\n<h4>Temp folder filled with DISM servicing files &#8212; e.g., DismHost.exe and others<\/h4>\n<p>Each time you run Disk Cleanup and cleanup system files, old drivers, or Windows Update files, Disk Cleanup runs DISM in the background, which in turn copies the DISM servicing files to a subdirectory in your Temp folder.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/11\/dism-servicing-files-in-temp.png\" alt=\"dism servicing files in temp folder\" width=\"639\" height=\"559\" class=\"alignnone size-full wp-image-41392\" \/><\/p>\n<p>However, neither Disk Cleanup nor DISM cleans up those files after servicing.<\/p>\n<p>Over time, you may end up with multiple copies of DISM servicing files in different subfolders under Temp.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-41388\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/11\/dismhost-subfolders-multiple.png\" alt=\"dismhost servicing files fills up TEMP folder\" width=\"662\" height=\"679\" \/><\/p>\n<p>Cleaning up &#8220;Temporary Files&#8221; in Disk Cleanup also may not help.<\/p>\n<p>To fix the issue, do the following:<\/p>\n<ol>\n<li>Set the <strong>LastAccess<\/strong> registry value to 0. Please see the previous paragraph for more information.<\/li>\n<li>Run cleanmgr.exe <strong>as administrator<\/strong>. Running it as a standard user does not help.<\/li>\n<li>Enable &#8220;Temporary files&#8221; checkbox, and click OK.\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-41389\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/11\/cleanmgr-temporary-files.png\" alt=\"dismhost servicing files fills up TEMP folder - temporary files\" width=\"381\" height=\"460\" \/><\/li>\n<\/ol>\n<p>That&#8217;s it. Disk Cleanup has now almost emptied your temporary directory. All those temporary DISM servicing folders have been cleared.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-41390\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/11\/cleanmgr-temp-folder-empty.png\" alt=\"cleanmgr temporary files cleared\" width=\"682\" height=\"497\" \/><\/p>\n<\/div>\n<p><em>The above is the same registry edit that I wrote about in 2005. It applies to Windows 2000\/XP through Windows 10. Ref:\u00a0 <\/em><a href=\"https:\/\/www.winhelponline.com\/xp\/cleantemp.htm\" target=\"_blank\" rel=\"noopener noreferrer\"><em>Alter the &#8220;LastAccess&#8221; value for cleaning the Temporary files using Disk Cleanup utility<\/em>.<\/a><\/p>\n<p>Running Disk Cleanup with the default &#8220;LastAccess&#8221; value left lots of files and folders untouched.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4497\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/11\/temporary-files-clear-all-5.png\" alt=\"disk cleanup delete all temp files\" width=\"680\" height=\"670\" \/><\/p>\n<p>Only the folders created (and files accessed) before Oct-25 were cleared &#8212; clean up done today, Nov-1.<\/p>\n<p>After applying the registry setting, I reran Disk Cleanup.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4495\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/11\/temporary-files-clear-all-4.png\" alt=\"disk cleanup delete all temp files\" width=\"374\" height=\"470\" \/><\/p>\n<p>The temporary files are all gone, except the <a href=\"https:\/\/www.winhelponline.com\/blog\/find-process-locked-file-openfiles-utility\/\">in-use files and folders<\/a>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4498\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/11\/temporary-files-clear-all-6.png\" alt=\"disk cleanup delete all temp files\" width=\"680\" height=\"567\" \/><\/p>\n<h4>Temporary files Locations<\/h4>\n<p>As a side note, if you clean up Temporary Files when Disk Cleanup is running elevated (&#8220;Run as Administrator&#8221;), &#8220;temporary&#8221; files in the following folders and sub-folders are cleared as well, in addition to files and folders in the user&#8217;s TEMP directory.<\/p>\n<ul>\n<li>%WINDIR%\\Temp<\/li>\n<li>%WINDIR%\\Logs<\/li>\n<li>%WINDIR%\\System32\\LogFiles<\/li>\n<\/ul>\n<p><em>Editor&#8217;s note: I don&#8217;t use 3rd party cleanup and maintenance tools as I still rely on Disk Cleanup for this task. However, I <a href=\"https:\/\/support.microsoft.com\/en-us\/kb\/253597\" target=\"_blank\" rel=\"noopener noreferrer\">automate it<\/a> using <a href=\"https:\/\/www.winhelponline.com\/blog\/automatically-clear-temp-files-every-login-using-disk-cleanup-batch-file\/\">Cleanmgr.exe switches &#8220;\/sageset&#8221; and &#8220;\/sagerun.&#8221;<\/a><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Disk Cleanup (Cleanmgr.exe) is a built-in tool in Windows that offers some useful cleanup options not available in other 3rd party cleanup tools. It can remove superseded device drivers, Temporary Files, Internet Explorer cache, obsolete Windows Updates, Previous Windows Installation (Windows.old) folder, and much more.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[7],"tags":[155,441],"class_list":["post-4491","post","type-post","status-publish","format-standard","hentry","category-windows","tag-disk-cleanup","tag-registry"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":8555,"url":"https:\/\/www.winhelponline.com\/blog\/prevent-disk-cleanup-storage-sense-from-deleting-downloads\/","url_meta":{"origin":4491,"position":0},"title":"Stop Disk Cleanup and Storage Sense from Emptying your Downloads folder","author":"Ramesh","date":"April 8, 2019","format":false,"excerpt":"If you use Disk Cleanup, you will want to be aware of a change to its options since the October 2018 feature update (v1809). Disk Cleanup, now also has the option to delete the contents of your Downloads folder. However, many users like to use the Downloads folder as permanent\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"disk cleanup remove downloads option","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/04\/disk-cleanup-downloads-folder-2.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":4640,"url":"https:\/\/www.winhelponline.com\/blog\/automatically-clear-temp-files-every-login-using-disk-cleanup-batch-file\/","url_meta":{"origin":4491,"position":1},"title":"Automatically Clear Temp Files Using Disk Cleanup, Storage Sense or Batch file","author":"Ramesh","date":"November 22, 2016","format":false,"excerpt":"The TEMP directory (%temp%) gets bloated over time as applications store data over there and don't always remove the files and folders they created. And, software installers extract the contents of the setup packages to the %temp% folder and fail to do the cleanup act when the installation is complete.\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"windows 10 storage settings cleanup options","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/11\/storage-settings-cleanup-options.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/11\/storage-settings-cleanup-options.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/11\/storage-settings-cleanup-options.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":10740,"url":"https:\/\/www.winhelponline.com\/blog\/free-up-hard-disk-space-windows\/","url_meta":{"origin":4491,"position":2},"title":"How to Free Up Gigabytes of Disk Space in Windows","author":"Ramesh","date":"August 18, 2019","format":false,"excerpt":"Windows 10 updates, especially the feature updates, consume enormous disk space as Windows stores the older copies in case you want to roll back to the previous version. Hard disk drives have become cheaper and affordable nowadays. A 1 TB SATA HDD costs less than $50. But, if you're using\u2026","rel":"","context":"In &quot;Utilities&quot;","block_context":{"text":"Utilities","link":"https:\/\/www.winhelponline.com\/blog\/category\/utilities\/"},"img":{"alt_text":"chrome cache localstorage service worker cache","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/08\/chrome-storage-dev-tools.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/08\/chrome-storage-dev-tools.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/08\/chrome-storage-dev-tools.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/08\/chrome-storage-dev-tools.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":5865,"url":"https:\/\/www.winhelponline.com\/blog\/thumbnail-cache-automatically-deleted-windows-maintenance\/","url_meta":{"origin":4491,"position":3},"title":"[Fix] Thumbnail Cache Auto Deletion Problem in Windows 10","author":"Ramesh","date":"November 3, 2017","format":false,"excerpt":"When you browse a folder containing media files, Windows generates thumbnail images of your image and video files if the folder view is set to thumbnail view (medium, large or extra large icons.)\u00a0The generated thumbnail is cached and written to database so that the system need not regenerate the miniature\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"thumbnail cache folder","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2017\/11\/thumbnail-cache-location.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2017\/11\/thumbnail-cache-location.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2017\/11\/thumbnail-cache-location.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1590,"url":"https:\/\/www.winhelponline.com\/blog\/delete-windows-old-folder-previous-versions\/","url_meta":{"origin":4491,"position":4},"title":"How to Delete Windows.old folder [Previous versions of Windows]","author":"Ramesh","date":"February 6, 2016","format":false,"excerpt":"Windows Operating System upgrades and version updates would leave plenty of files behind in the system drive. This is because Windows keeps the files from the previous versions of Windows in a separate folder in case the user wants to roll back the major update (or OS upgrade). For instance,\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"how to delete windows.old folder","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/02\/cortana-localstate-folder-delete.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/02\/cortana-localstate-folder-delete.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/02\/cortana-localstate-folder-delete.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":38,"url":"https:\/\/www.winhelponline.com\/blog\/serious-disk-cleanup-problem-caused-by-broken-registration\/","url_meta":{"origin":4491,"position":5},"title":"Serious Disk Cleanup Problem in Windows caused by Broken Registration","author":"Ramesh","date":"February 29, 2008","format":false,"excerpt":"Reader's Query:\u00a0\u00a0\u00a0I have a 160GB Western Digital Hard Drive partitioned into a 40GB Operating System partition and the other 120GB for my files. However, when I run Disk Cleanup utility from within Vista Ultimate, it shows multiple 131GB options for me to clean up. After I clicked OK to clean\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2008\/02\/cleanmgr_risk.gif?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/4491","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/comments?post=4491"}],"version-history":[{"count":0,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/4491\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/media?parent=4491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/categories?post=4491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/tags?post=4491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}