Just a tip. This will help you to list files count by extension.
Get-Childitem c:\local -Recurse | where { -not $_.PSIsContainer } | group Extension -NoElement | sort count -desc
Just a tip. This will help you to list files count by extension.
Get-Childitem c:\local -Recurse | where { -not $_.PSIsContainer } | group Extension -NoElement | sort count -desc
Next post: Get information about remote process using powershell
Previous post: Windows 2008 R2 supports Exchange 2007 now
Comments on this entry are closed.
Awesome – saved my life
hi
that’s grate
I need this code
😉
Brilliant. Glad I didn’t spend any time reinventing the wheel. Exactly what I needed. Thank you.
Thank you – saved my day !!!!
Just what I needed. Thanks.
If you’re using a newer version of PS, you can replace the where clause with -file.
get-childitem c:\local -file |group Extension -NoElement |sort Count -desc
Don’t know how much faster this is, but there is a performance improvement.
How to do output in percent (or better both)?
I don’t have a mind how to do it in one string with only one pass.
E para verifica o tamanho ocupado no disco por cada extensão?
No provision available to check the space occupied by each extension type.
Awesome! thank you 🙂
Man… in 2019 this is still gold. If you are using the latest PS version try the following if yours is not working:
Get-ChildItem C:\windows\system32 -Recurse | Where { -not $_.PSIsContainter } | group Extension | Select Count, Name | Sort Count -Descending
Cheers!
Thank you for sharing.
That’s awesome! Just what I needed.
I modified it a bit so it will prompt for the path (UNC paths work with this, which is what I need):
$Path = Read-Host -Prompt ‘What is the directory or path?’
Get-Childitem $Path -Recurse | where { -not $_.PSIsContainer } | group Extension -NoElement | sort count -desc
Great. Thanks for sharing.
is there a way to speed this up? My folders have in excess of 3-10M files each and this is taking forever.
Help would be appreciated!!
Unfortunately – it ain’t showing full result number in case of large amount of files. For instance i have folder with over 26milions files, and this script in result shows “….932”, instead of “26121932”
Tommy try this, it solved the issue for me.
Get-ChildItem d:\users -Recurse | Where { -not $_.PSIsContainter } | group Extension | Select Name, Count | Sort Count -Descending