March 21st, 2015

PowerTip: Use PowerShell to Count Types of Images

Doctor Scripto
Scripter

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.

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.