Skip to content

Instantly share code, notes, and snippets.

@JustinGrote
Created August 18, 2017 01:54
Show Gist options
  • Save JustinGrote/f4f5b9dae790602631d3b47825d36bd5 to your computer and use it in GitHub Desktop.
Save JustinGrote/f4f5b9dae790602631d3b47825d36bd5 to your computer and use it in GitHub Desktop.
Remove Folders with less than a certain filesize in them. Works on Powershell Linux too with beta5
(get-childitem) | % {[PSCustomObject]@{Name=$_.Fullname;Size=(get-childitem $_ -recurse | % length | measure -sum | % sum | % {$_/1MB})}} | where size -lt 100 | % {Remove-Item -Recurse -Force $_.name}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment