≡ Menu

count files by extension using powershell

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

{ 6 comments… add one }

  • Maria March 13, 2012, 8:18 am

    Awesome – saved my life

  • hamid April 25, 2012, 10:14 am

    hi
    that’s grate
    I need this code
    😉

  • Rob Andren March 6, 2013, 11:01 am

    Brilliant. Glad I didn’t spend any time reinventing the wheel. Exactly what I needed. Thank you.

  • lync August 8, 2014, 8:10 pm

    Thank you – saved my day !!!!

  • Jim October 20, 2014, 7:13 pm

    Just what I needed. Thanks.

  • Brian July 2, 2015, 11:00 pm

    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.

Leave a Comment