These days, a relatively clean and uncomplicated Windows 10 or 11 system disk might be home to more than 250,000 files and 90,000 folders. A more complex, application-heavy system disk might contain between half a million and a million files. My Windows 11 production PC has over 970K files and 275K folders, for example. That’s a lot of stuff!
Indeed, all those files need not necessarily be kept around. That’s why it’s a good idea to practice regular disk hygiene. This is exactly what is explained and explored here, with plenty of examples and screen shots to illustrate the cleanup process. Best of all, the tools that help you tidy up won’t cost you a dime.
Step 1: Run built-in Windows disk cleanup tools
From time immemorial, Windows has included a utility for cleaning up disk space — namely, Disk Cleanup, also known as cleanmgr.exe. In Windows 10, users gained a second method to clean up disk space: the “Free up space now” option is part of its Settings-based “Storage Sense” facility aimed at optimizing storage. In Windows 11, this shows up as “Cleanup recommendations.”
There has been speculation that Disk Cleanup might disappear as Settings takes over Windows management and controls. Even so, the Disk Cleanup utility remains ready, willing, and able to work in Windows 11 22H2 as I write this story. Either the Settings or Disk Cleanup approach provides a great way to excise extraneous and unneeded Windows files (for Windows 10 and 11 versions across the board).
To launch Disk Cleanup, type disk clean or cleanmgr.exe into the Start menu search box. The Disk Cleanup desktop app should appear at the top of those search results. If you can, select Run as administrator from the resulting options menu. Why? Only then does it offer to clean up redundant or outdated OS files (such as old OS files after an upgrade, or old updates) as well as other Windows leftovers.
After Disk Cleanup scans your system, Figure 1 shows a reasonable facsimile of what you’ll see in Windows 11.
Scroll through the checkbox items in the pane labeled “Files to delete” and pick stuff you’d like to lose. The numbers in the right column indicate how much disk space each item occupies. Don’t delete old OS versions or updates if you think you might want to roll back to an earlier version. Note also that the Downloads item represents the contents of your personal Downloads folder, so don’t delete it unless you’re sure you don’t need anything it holds.
Figure 1 includes a previous Windows 11 installation, for a total recovery of 12.7GB. That’s a sizable chunk of disk space.
In Windows 10, the Settings-based cleanup option is available through Settings > System > Storage > Configure Storage Sense or run it now > Free up space now. On the “Free up space now” pane, click the Clean now button. This cleans up storage in much the same way as if you’d run Disk Cleanup and clicked all available boxes — removing temporary files, update or upgrade files, delivery optimization files (designed for sharing on your local network but seldom used), obsolete device driver packages, and more. It will also empty the recycle bin.
This process can — and often does — take several minutes to complete. While it’s running, it looks like what’s shown in Figure 2.
Windows 11’s “Cleanup recommendations” feature is available through Start > Settings > System > Storage > Cleanup recommendations. On the “Cleanup recommendations” pane, click Advanced options. These options appear in Figure 3, with checkboxes to select (or avoid) their contents for deletion.
The total disk savings from this particular cleanup selection in Windows 11 come to just under 3.5GB, similar to what you’d get from Disk Cleanup. It takes a bit of time to read through and select what you want, but it’s quite easy to use. Some may find it preferable to Disk Cleanup, in fact.
Step 2: Run UnCleaner to catch what built-in tools miss
Josh Cell is a Francophone developer in Canada who’s built a peachy and free utility called UnCleaner. It can ferret out and remove temporary and obsolete log files that even Windows’ built-in utilities don’t catch and kill. You can download the latest version of UnCleaner (1.7) from Major Geeks. Don’t worry that this tool shows a 2012 date: I can attest it still works fine on Windows 10 and 11 systems in mid-2023.
Running on the same production PC upon which I just ran Disk Cleanup, UnCleaner finds nearly 400MB of files to clean up despite a notionally clean status, as shown in Figure 4.
Simply click the Clean button (lower left) to excise those files. You’ll never get this tool to delete everything it reports, because some of those files are locked by Windows runtime constraints. But sometimes you’ll see a message that says, “Good. Your system is very clean.” ‘Nuff said!
Step 3: Use DriverStore Explorer to dismiss obsolete device drivers
DriverStore Explorer (RAPR.exe) is a free, open-source tool that you can download from GitHub. Always be sure to grab the most current release (0.11.92 as of this writing). Unless you’re a real Windows driver wizard, you need only click two buttons to make RAPR do its thing: Select Old Driver(s) and Delete Driver(s).
You must, however, run RAPR in administrator mode (right-click its icon and select Run as administrator). When you start it up, you’ll see a list of installed drivers with checkboxes. Click the Select Old Driver(s) button at the top right of the screen, and the program will automatically check the boxes for the older driver versions it finds. They’re highlighted with blue checkmarks in Figure 5.
When you click Delete Driver(s), RAPR will attempt to remove all highlighted items. It won’t actually remove any it finds in use, so this is a surprisingly safe operation. Power users and experts can find a lot more for RAPR to do (see “How to reduce Windows driver bloat” for details), but most regular users will simply enjoy its ability to clean up old, outmoded drivers.
Notice in Figure 5 that a raft of Intel Bluetooth drivers is among the items targeted for deletion. That’s because the Intel Driver & Support Assistant keeps on installing Bluetooth drivers (monthly, if not more often). This makes for lots of duplicates. The current selections will recover 635MB of disk space.
I’ve seen some RAPR runs recover multiple gigabytes, but space savings are seldom larger than that. First-time users may recover 3 to 5GB when cleaning up numerous driver files. (Graphics drivers often exceed 1GB in size; those add up quickly.)
Step 4: Use DISM to clean the Component Store
Most Windows OS files reside in the WinSxS folder, also known as the Component Store. After you install a cumulative update, and sometimes after other updates, the Component Store may contain duplicate, obsolete, or orphaned elements. You can use the Deployment Image Servicing and Management (DISM) tool at the command line to check the Component Store from time to time. Such checks will tell you if a cleanup is needed.
To get started, you’ll need to open an elevated PowerShell or Command Prompt window. On the Windows desktop, press the Windows key and X, then select Windows PowerShell (Admin) from the resulting pop-up menu. (Alternatively, you can type powershell into the Start menu search box, then right-click Windows PowerShell and select Run as administrator from that pop-up menu.) In the Administrator: Windows PowerShell window that appears, type this string and hit Enter:
dism /online /cleanup-image /analyzecomponentstore
You’ll see something like what’s shown in Figure 6.
As I wrote this story, I had just installed a Cumulative Update and other update items earlier that week. Sure enough,
/analyzecomponentstore reported that there was one reclaimable package ready for cleanup. Notice that the response text reported “Yes” in the field labeled “Component Store Cleanup Recommended.” That’s your clue that DISM has something it can clean up on your behalf.
To make that happen, in the Administrator: Windows PowerShell window, enter this string:
dism /online /cleanup-image /startcomponentcleanup
The results appear in Figure 7, with an extra
/analyzecomponentstore to show the results of the cleanup.
When the numbers for the second
/analyzecomponentstore operation get compared to the first, we see the following numbers:
- Size of component store: 10.26GB vs. 7.35GB (diff: 2.91GB)
- Actual size of component store: 9.81GB vs. 7.18GB (diff: 2.63GB)
- Shared with Windows: 6.10GB vs. 6.07GB (diff: 0.03GB)
- Backups and disabled features: 3.70GB vs 1.11GB (diff: 2.59GB)
If you add the savings for “Shared with Windows” and “Backups and disabled features,” you get 2.62GB, which is nearly the savings in the actual size of the component store (2.63GB) — just as it should be. Recently updated systems may recover up to 3 or even 4GB using this technique. (Actual results depend on the number and size of reclaimable packages removed.)
For more incredibly useful things you can do with DISM, see “Why DISM is the Swiss Army knife of Windows maintenance.”
Step 5: Inspect the system drive using WizTree
Once all preceding cleanups are complete, it’s a good idea to inspect the system drive to see where the big files are. I use the free, donation-ware WizTree program, but TreeSize Free is a worthy alternative. Both programs produce treemap diagrams — graphical renderings of disk contents that make it easy to spot big files and folders.
Figure 8 shows the C: drive from my Lenovo X12 Hybrid tablet.
Remember, you’re looking for big files, because getting rid of them provides useful, quick wins in the disk space recovery game. Right here, I see that the largest files are the ones you’d expect to see — namely, the system hibernation file (hiberfile.sys) and the system page file (pagefile.sys), in green at upper right.
After those behemoths (6.3 and 2.4GB, respectively), the next largest files appear in OneDrive (image folders in greenish-yellow and purple, center) and in the Windows Recovery agent ($WinREAgent, royal blue at lower right). All is as I’d expect. If I needed to save space, though, I’d see about pruning the images and videos in OneDrive.
By clicking other “big blocks” in the treemap, you can quickly figure out where your biggest potential space recovery opportunities lie. You won’t be able to get rid of all of them — the paging and hibernation files must stay, for example — but if some of them can go, big space savings can result.
Practice makes perfect
If you perform such cleanups periodically (I shoot for at least once a month), you’ll be able to keep your space consumption under much better control. Try this regimen out for yourself and you’ll soon see what I mean. And don’t forget to slog through the Users folder (especially your account subfolder) from time to time, too, because junk too often tends to accumulate there.
Then, you can blissfully enjoy your clean machine!
This article was originally published in January 2019 and updated in September 2023.
Copyright © 2023 IDG Communications, Inc.
Source: Computer World