I recently asked myself the question of just how many Powerpoint files I had on my work laptop and on my home machines. It turns out that it was pretty easy to figure that out using Windows Powershell, with some commands I found on a random website.
I haven’t used Powershell much, but I find cool and interesting -and rather dissimilar to the typical Unix-clone or (horror) DOS clone you tend to find in scripting environments on all kinds of machines.
To count my Powerpoint files, I had to combine the Get-ChildItem command (which is a funky name for “ls”) with a pipe into Group-Object to count the number of each type of file. Adding -NoElement at the end avoid printing the objects as a list (thankfully abbreviated to what fits on a single line by default). In the end, this counts all Powerpoint files from the current directory and down:
Get-ChildItem -Recurse -Include *.pptx, *.ppt | Group-Object Extension -NoElement
To figure out if any are read-only, which I needed to do for some debugging, there was an easy option to Group-Object:
Get-ChildItem -Recurse -Include *.pptx, *.ppt | Group-Object IsReadOnly -NoElement
Neat. This told me the number of read-only Powerpoint files in the entire structure.