Skip to content

Instantly share code, notes, and snippets.

@jrwarwick
Created August 25, 2016 17:03
Show Gist options
  • Save jrwarwick/ff1cf0ae885bc4ecce745b080002fa22 to your computer and use it in GitHub Desktop.
Save jrwarwick/ff1cf0ae885bc4ecce745b080002fa22 to your computer and use it in GitHub Desktop.
In current working directory, list subfolders that contain at least 100MB in files.
Get-ChildItem -Force | Where-Object { $_.PSIsContainer } | ForEach-Object { $_.Name + ": " + "{0:N2}" -f ((Get-ChildItem $_ -Recurse | Measure-Object Length -Sum -ErrorAction SilentlyContinue).Sum / 1MB) + " MB" } | % { if ($_ -notmatch ': [0-9]{1,2}\.') {$_;}
@jrwarwick
Copy link
Author

Interesting note: on a recent edition of Windows, when the disk was too full, this command would, without error, just lie about disk usage. Entire subdirectories would be reported as 0-bytes. Of course this sort of tool is most needed when you have such exhausted conditions. Caveat Emptor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment