Since having a system migrated to Windows 10, I’ve noticed a trend of the hard-drive getting significantly fuller now. I’ve done all the standard post-migration cleanups. I cleared over 40 GB of old software packages off the system and was feeling pretty good. The next day all my space-gains were lost and I was back at 100 GB of free space where I started.
I suspect there is some caching activity going on in the background and that it running off a quota that keeps me returning to the magical 100 GB free of a 500 GB drive.
Normally, I’d just run one of these tools to identify the space/file hogs and start cleaning up. I’ve ordered these in my general preference; though I like them all for slightly different things they bring to the table on a space-hunt.
- SpaceSniffer – freeware – Uderzo Software
- TreeSize Free – freeware – JAM Software
- WizTree – freeware – Antibody Software
- Folder Size – freeware – MindGems
- SequoiaView – freeware – Technische Universiteit Eindhoven
- WinDirStat - Windows Directory Statistics – open source
- Disk Usage - Windows Sysinternals
However in this case I cannot use any third-party tools and must stick with using Microsoft OS-based solutions only.
So that led me to find a script I could use in PowerShell.
I’ve divided them into file-size analyzers and folder-size analyzers.
I found it is relatively easy to hunt down singular files on your system in PowerShell that are the largest. However, what happens if you have a bunch-load of very small files? Individually they may never float to the top, however in aggregate, they could add up to a lot of space usage.
I’ve listed these as well in my order of preference.
Note: They all seemed to run fine on my Win 10 systems in PowerShell ISE – though tweaking was needed for each one to target specific folders and/or report outputs – depending on the script.
PowerShell File-Hog Hunters
- Find Largest (Or Smallest) Files In A Directory Or Drive With PowerShell - Daniel Schroeder's (aka deadlydog) Programming Blog
Daniel’s script is totally brilliant. Not only is it a “one-liner” but it generates a beautiful table for output that can be sorted by column and filtered by criteria. I did note that the calculated file-size value didn’t seem to be accurate but haven’t figured out why that was. Daniel also has some tips in the comments and a link to this page in case you want to modify the script from a file-size hunt to a folder-size hunt. - How to make a report of largest files on a file share – Michael (Netwrix) on Spiceworks – This was nice because it generated a very sweet CSV file to be opened in Excel.
- Script to list files by type and size, export to Excel - Adam Dimech's Coding Blog – Another nice script that exports to a designated CSV file.
- Use PowerShell to Explore Disk Utilization on Your Computer – Hey, Scripting Guy! Blog – Not only is this a very handy script, the Scripting Guy walks you through what the script actually does.
- Find top 10 large files in a disk - VBScript and Powershell Scripts: Powershell bog. Simple.
- PowerShell Script: Find the 25 largest files and list folder sizes for any drive - RobWillis.info – This one is much more advanced and outputs a lot of information to the console for the report. It can also generate output to a TXT file. Definitely cool stuff.
- Powershell Script List Top 50 Largest Files – This is another very simple script but does the job. The comments have a few tweaks you can add to output to a file or change size to MB.
- Script Get-LargestFiles - What's the biggest space hogs on my disk? – This one is also pretty helpful.
PowerShell Folder-Hog Hunters
- TechNet Disk Usage Analyser – simulates the Sysinternals Disk Usage tool.
- How to find biggest folders (by number of files) in Windows - Super User
- Getting Directory Sizes in PowerShell – Hey, Scripting Guy! Blog. Spend some time in the comments for additional tweaks to the script.
If you do export output to CSV and don’t “pre-format” the bytes output to MB, here is a tip on a custom formatting rule in Excel you can use to make it more readable.
formatting - How can I format bytes a cell in Excel as KB, MB, GB etc? - Stack Overflow
I’ve not loaded Ubuntu on Windows to have a Bash console, but in looking for tools, I came across this that looked pretty neat: ncdu: Identify Large Files on Windows 10 - Trevor Sullivan
Finally, on Win 7 I used a pretty small set of common keyboard shortcut to navigate my way around the system. In Windows 10, I’m finding a desire to expand my quick-access key combo skills. Here are some good resources:
- Download Shortcut keys for Windows 10 - Official Microsoft Download Center
- Windows Shortcuts 101/ The Ultimate Keyboard Shortcut Guide – (direct PDF file link) – MakeUseOf blog
- Complete List of Windows 10 Keyboard Shortcuts and Run Commands – gPost
- Windows 10 end user readiness – Microsoft guides, tutorials, and other resources.
- New tools to help drive Windows 10 adoption – Microsoft guides, tutorials, and other resources. For readiness and user communications, technical references and documentation, and post-deployment support helps.
- Note: at the bottom of that page there is a tiny link to download the full suite of Windows 10 deployment resources. (ZIP)
If I’ve missed a useful script or you have any tips for hunting for space/file hogs using only “on-board” native Windows 10 OS tools, please drop a comment!
I expect I’ll be adding to the list of links in this post too as I uncover more PowerShell scripts that could be useful. As I post this, I think I am overlooking one or two others that I found useful
Cheers!
--Claus V.
No comments:
Post a Comment