Created
December 2, 2020 13:56
-
-
Save dmlogv/25c46fe364b0e61b67c207d1a90b2ffd to your computer and use it in GitHub Desktop.
Space consumption by file types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Summarize file sizes in the current directory | |
Name Count Size, Mb | |
---- ----- -------- | |
.CR2 18043 422,723 | |
.jpg 125904 284,799 | |
.img 7 238,507 | |
.mp4 1105 86,354 | |
.mov 170 69,938 | |
.pdf 4973 39,899 | |
.exe 2893 13,384 | |
.psd 302 12,854 | |
.avi 82 12,265 | |
.mp3 2854 10,817 | |
.xz 1 10,516 | |
.zip 5014 9,023 | |
.png 19248 8,980 | |
.mpg 33 7,852 | |
.djvu 1057 7,393 | |
.mkv 18 6,523 | |
.ARW 169 5,952 | |
.tif 811 5,554 | |
.1CD 38 5,391 | |
.rar 383 3,839 | |
#> | |
$filestat = Get-ChildItem . -File -Recurse | | |
Select-Object Extension, Length | | |
Group-Object Extension | | |
Select-Object Name, Count, @{l='Size'; e={ | |
$_.Group | | |
Measure-Object -Property Length -Sum | | |
Select-Object -ExpandProperty Sum | |
}} | |
$filestat | | |
Sort-Object Size -Descending | | |
Select-Object -First 20 Name, Count, @{n='Size, Mb'; e={ | |
"{0,12:N3}" -f ($_.Size / 1Mb) | |
}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment