You may think you have only a few, but Windows has other ideas.
Only 117,000? That seems light.
Pictured above is the result of my recent scan of one of my Windows 11 demo machines showing over a million files. 1,000,000!
While I’m always tempted to answer “why” this way, let’s dive into some of what’s going on.
Become a Patron of Ask Leo! and go ad-free!
So many files
Windows itself is made up of thousands of files that implement its massive feature set and security. Applications are also typically made up of hundreds if not thousands of files, and create even more data files associated with your account. Also, Windows Defender might look like it’s over-reporting the number of files scanned because it counts the contents of archive files separately.
Counting files
As we’ll see in a moment, Windows Security counts files in an odd way. We need a better way to count files.
SysInternals Tools to the rescue. When installed, it adds a command line tool called “du” for disk usage.
In this example, with “C:\Windows” as my current directory, running “du .” calculates the usage of that folder and all subfolders. My Windows folder has 78,404 files and 39,329 folders and takes up roughly 11GB of disk space.
If I run the command at the root of the drive1 — “C:\” — I get the information on everything stored on that hard drive.
147,041 files on this machine.
But wait… that’s not the same as the million and change reported by Windows Security’s full scan. What gives?
Files contain files
TIL2 that Windows Defender:
- Scans the contents of many archives, including zip files and others.
- Counts the contents of those archives as separate files.
If I create a zip file containing two files and then scan it with Windows Defender, the scan reports three files: the physical zip file itself plus the two files it contains.
There are a lot of archive files in Windows. Zip files are perhaps the best known, but “msi” (Microsoft InStaller) files, “cab” (Cabinet) files, and even Microsoft Office’s ‘x’ series of files3, like “docx”, “xlsx”, “pptx”, and so on, are all single files that contain other files. Sometimes a LOT of other files.
If you right-click on one example Excel .xlsx file and select “Scan with Microsoft Defender…” you’ll get this result:
The single .xlsx file contains 34 files scanned and reported separately by Windows Defender.
Windows is big and general-purpose
One of the reasons there are so many files included in Windows itself (for example, the 78,404 files in my C:\Windows folder) is that it provides a truly massive number of features and functionality. Many more than you might imagine. And even if you don’t use everything Windows has to offer, all the files for its operation are there just in case.
On top of that, many files are duplicated as real-time backups. The System File Checker, for example, will fetch a backup copy of a file should it determine that a file’s primary copy has been damaged.
One of the most common responses is “Why not just have a lite/smaller/consumer version?” Unfortunately, down this path lies much confusion and more instability. Windows is complex enough without adding additional combinations of features and functionality in some editions and not others. In a sense, they already do in the Home/Pro versus Enterprise editions. That’s complicated enough.
Besides, what you would want in a lite version probably doesn’t match what I or someone else might want. Slowly but surely, we’d arrive back at something resembling the current Home and Pro editions.
Applications are massive
Microsoft Office/Microsoft 365 is installed on this machine, and it has over 8,000 files (not including data and configuration files stored in other folders).
Once again, Office is a large application with many, many features whether you use them or not.
While Office might be one of the larger applications you install, it’s not uncommon for even simple applications to be made up of hundreds of separate files, particularly if they’re multi-lingual.
It all adds up.
Data adds up
The one that surprised me was the “AppData” folder associated with my login account. I found over 26,000 files there.
This is where applications (including Windows itself) store data that is unique to your login account. For example, Microsoft Office is responsible for over 5,000 files here. These are files that preserve the options you’ve selected and the program configuration specific to your login, history, and who knows what else.
Most programs store some amount of information here, and since it’s typically something you never see, application authors sometimes go a little nuts with how they divvy up the data they preserve on your behalf.
Do this
There’s really nothing to do here other than don’t be surprised by the large number of files on your system, especially the large number of files reported by Windows Defender’s full scan. It’s all part of how Windows and Windows applications are organized.
Be sure to subscribe to Confident Computing! It’s my weekly newsletter that gives less frustration and more confidence, solutions, answers, and tips in your inbox every week.
P.S.
My Ubuntu Linux server (no graphical interface, command line only) has 170,000 files, and a relatively recent reinstall of my Mac Pro running macOS Monterey appears to have over 2 million.
It’s necessary for antimalware programs to check individual files inside compressed files. Otherwise, it would be easy to hide malware inside .zip or other compressed files.
For example, Gmail wouldn’t allow me to send .exe, .dll or other executable files. I used to compress them using .rar and they would get through Gmail’s filters. Hopefully, Gmail has fixed that and checks more compression formats.
I was just surprised that a .zip file wasn’t counted just as a single file.
My C: drive is running out of room. It appears that it’s because of extra program files that I don’t need. How do I get rid of some of the “junk” to make more room for my data files and the all-important working cache?
I’d run both Windows’ Disk Cleanup in system files mode and also run CCleaner which can delete older System restore points. System restore points can use up a huge amount of disk space if not managed correctly.
In CCleaner:
Click the Tools icon on the left.
Click System Restore.
Select the System Restore point you want to remove.
(You can use Ctrl+Click or Shift+Click to select multiple System Restore points)
Click Remove.
Confirm the deletion. Click OK.
Using Disk Cleanup in Windows
CCleaner, a Windows Cleaning Tool
How To Reduce System Restore Disk Space Usage
I get the fact that Windows is so large because it is multi-purpose. But does that excuse Windows making things even worse by locking the Temporary Internet Files folder in Disk Cleanup? Perspiring minds want to know!
Non-comprehendingly,
James
Temporary Internet files aren’t locked by Disk Cleanup. They are locked by the browser and can’t be deleted while the browser is open because they are open in the browser.Close the browser and they can be deleted.
Hello Leo. When I click to accept a cookie on a website, why do I have to do it again every time I visit the site? I thought the point of a cookie was to store easily-referenced info already gathered. Why doesn’t the website look for a previously stored cookie and – if already there – not bother to ask the operator to click to rewrite it?
Do you have a browser option set to clear cookies on exit? Or do you run some kind of cleaning utility?
If it’s just one site, I’d blame that site’s implementation.
And I hate that cookie notification requirement. It’s so stupid.
Clicking to accept cookies is because of European data protection laws. They require a website get permission before placing a cookie. A well designed website would include an ‘accepted cookies’ cookies and not pop that question again for a while. Since that popup is just to comply with the law, many web developers slapped the warning in without as much thought as the should have.
Hello Mark,
I have tried that, along with every other suggestion that I’ve been able to find on the interwebs, and nothing, and I mean absolutely nothing has worked so far. Now the folder has 700 MB, and continues to grow larger every day. I am at (what passes for) my wit’s end. At the risk of being even more masochistic, what else might I try?
Head-bashingly,
James
Hit me up at https://askleo.com/ask, and then respond to the auto-response with a screen shot of what you see? I’m curious now.
Sometimes, it’s necessary to migrate to a larger disk. Sounds like it might be time for you. You can get an external drive and move some of those large files, or you can replace your computer’s system drive with a larger one.
How Do I Transfer My System to a Replacement Drive?
If you move files to an external disk they need to be backed up. As Leo says, “If your files are in just one place, they’re not backed up.”
For disk cleanup, try Microsoft’s PC Manager (beta). https://pcmanager.microsoft.com/en-us. I used to like CCleaner, but it’s become a sales tool for Avast security software (who bought CCleaner), and it even installs Avast on PCs that already have antivirus installed, if you let it. I find PC Manager to be simple and effective.