PowerTip: Use PowerShell to Count Images

Doctor Scripto

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.


Discussion is closed.

Feedback usabilla icon