How to extract a complete list of extension types within a directory?

Open the PowerShell Tool and Run the below command:

Get-Childitem "D:\testfolder\" -Recurse | WHERE { -NOT $_.PSIsContainer } | Group Extension -NoElement | Sort Count -Desc > "D:\FileTypes-Counts.txt"

Out put results:

Count Name
----- ----
35809 .jpg
29128 .xls
22239 .las
19186 .pdf
16577 .xlsx
10311 .dlis
5729 .sgy
3364 .docx
2831 .txt
1990 .tif
1847 .doc
1191 .lis
1140 .xml
1068 .pptx
998 .dat
656 .msg
640 .zip
601 .meta
586 .png
......

统计指定目录下最大的20个文件:

dir "D:\test" -Recurse | Sort-Object -Descending length | select-object name,length -First 20

猜你喜欢

转载自www.cnblogs.com/rusking/p/10633514.html