Man i do think this is a big step for windows , it's 2016 and still complex to pull a du -sh or df on windows.
Things we take for granted on *nixes.
Much love.
function directory-summary($dir=".") {
get-childitem $dir |
% { $f = $_ ;
get-childitem -r $_.FullName |
measure-object -property length -sum |
select @{Name="Name";Expression={$f}},Sum}
}
I could get a shorter non exact version if I was on windows.New-Alias -Name "du" -Value "Directory-Summary"
> Get-ChildItem C:\windows | Measure-Object -property length -sum
Count : 28
Average :
Sum : 6407920
Maximum :
Minimum :
Property : length
For 'df': > get-WmiObject win32_logicaldisk
DeviceID : C:
DriveType : 3
ProviderName :
FreeSpace : 21796540416
Size : 31685865472
VolumeName :
DeviceID : D:
DriveType : 5
ProviderName :
FreeSpace :
Size :
VolumeName :
DeviceID : Z:
DriveType : 4
ProviderName : \\veertu\share
FreeSpace : 44674220032
Size : 399999991808
VolumeName : VeertuFSFor du:
ls C:\Windows\ | measure length -sum
For df: gwmi win32_logicaldiskThey have neglected the CLI for years and powershell while I guess it has its uses for scripting is light years behind *nix stuff as an interactive shell.
You can -accepteula from the command line and the "installation" is downloading and extracting a zip file. If there's an internet connection, you could even run it straight off of Micrsoft's servers via SMB.