博文背景
使用powershell实现du -sh的功能
具体操作
param([string]$Directory)
get-childitem $Directory |
% { $f = $_ ;
get-childitem -r $_.FullName |
measure-object -property length -sum |
select @{Name="Name";Expression={$f}},@{Name="Sum (MB)"; Expression={"{0:N1}" -f ($_.sum / 1MB)}}}