Skip to content

Instantly share code, notes, and snippets.

@ulve
Last active July 17, 2023 06:28
Show Gist options
  • Save ulve/7e505b2487837afcc7fb to your computer and use it in GitHub Desktop.
Save ulve/7e505b2487837afcc7fb to your computer and use it in GitHub Desktop.
du-h in powershell
param([string]$Directory)
get-childitem $Directory |
% { $f = $_ ;
get-childitem -r $_.FullName |
measure-object -property length -sum |
select @{Name="Namn";Expression={$f}},@{Name="Sum (Mb)"; Expression={"{0:N1}" -f ($_.sum / 1MB)}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment