PowerTip: Use PowerShell to Count Types of Photos

PowerTip: Use PowerShell to Count Types of Photos

  • Comments 2
  • Likes

Summary: Use Windows PowerShell to count the different types of photo files on your computer.

Hey, Scripting Guy! Question How can I use Windows PowerShell to figure out how many of each type of photo file I have on my computer?

Hey, Scripting Guy! Answer Use the Get-ChildItem cmdlet to retrieve specific types of photograph files, and then pipe the results to the 
          Group-Object cmdlet, group on the Extension property, and use the –NoElement switch to remove
           individual file information:

Get-ChildItem -Recurse -Include *.jpg, *.cr2, *.png, *.bmp -Path e:\ | Group-Object extension -NoElement

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Didn't know about the -NoElement switch and it just happens that my last git commit can use this, thanks! Kudos :)