please add a dynamic -Summary switch to get-childitem in filesystem
PS C:\> Get-ChildItem C:\Users
Directory: C:\Users
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 10/13/2018 5:11 AM FOO
d-r--- 8/22/2013 8:36 AM BAR
d----- 10/16/2018 5:50 AM BAZ
------ 10/16/2018 5:50 AM 0 LOL
Summary: 4 items, 3 Directory, 1 File(s)
the summary must be written in host and not written in pipe
Size would be nice in the summary too. .
It's pretty straightforward to get this information, too, so I don't see any reason not to go for this...
# Sum of length = total size ; count of length = total files
# Sum of PSIsContainer = total directories
Get-ChildItem | Measure-Object -Property Length, PSIsContainer -Sum
Now, granted, on a length recursive search, adding that information to every section of the default output might be a bit much and slow things down slightly, but I suppose that it really wouldn't add an unreasonable amount of processing if it's only being done for the display formatting.
Seems we have dup. I can not find the issue /cc @lzybkr
As for implementation we could internally create (recursively for every directory) special psobject with statistics and output it to pipeline to get output like cmd.exe. Only formatting system should be enhanced to understand this.
@iSazonov - you were thinking of https://github.com/PowerShell/PowerShell/issues/2376
How about human readable output for numbers, e.g. KB, MB, GB, etc.
Please discuss in #2376
Most helpful comment
Size would be nice in the summary too. .