PowerTip: Use PowerShell to Count Types of Images

Doctor Scripto

Summary: Use Windows PowerShell to count different types of image files.

Hey, Scripting Guy! Question How can I use Windows PowerShell to see a count of the different types of image files on my computer?

Hey, Scripting Guy! Answer Use the Get-ChildItem cmdlet to find the image files and then pipe the results to the Group-Object cmdlet,
           for example:

dir -Recurse -ea 0 -File -path e:\data -include "*.gif","*.jpg", "*.png", "*.bmp" | 
group extension -NoElement

Note  Dir is an alias for Get-ChildItem and Group is an alias for Group-Object.


Discussion is closed.

Feedback usabilla icon