March 20th, 2015

PowerTip: Use PowerShell to Count Images

Doctor Scripto
Scripter

Summary: Learn how to use Windows PowerShell to count images.

Hey, Scripting Guy! Question How can I use Windows PowerShell to count images on a drive?

Hey, Scripting Guy! Answer Use the Get-ChildItem cmdlet, specify the path, and send the results to the Measure-Object cmdlet,
           for example:

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

Note  Dir is an alias for Get-ChildItem and Measure is an alias for Measure-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.