I needed to know the total number of pages in hundreds of PDFs. Thanks to cpdf - Coherent PDF Command Line Tools I was able to get this done from the Windows Command Prompt on Windows 8.1. Here’s the command I used,
> forfiles /s /m *.pdf /c "cmd /c C:\Users\Admin\Documents\cpdf\cpdf.exe -pages @path >> C:\Users\Admin\Documents\pages.txt && echo. >> C:\Users\Admin\Documents\pages.txt"
This populates pages.txt with number of pages in each PDF it comes across in the directory (and sub-directories) it has been run in. You can then paste pages.txt into any spreadsheet to calculate the sum of the series.
> cpdf.exe -pages sample-pdf-file.pdf
> forfiles /s /m *.pdf /c "cmd /c echo @file" # `/s` flag tells it to look into sub-directories. # `/m *.pdf` searches only PDF files. # `/c "cmd /c echo @file"` tells it to run `echo @file` command in cmd.
Categories: tutorial
Created: September 30, 2019
written in August, 2021. This is a 2 minute read
about: cycling, hiking, udaipur
written in March, 2020. This is a 2 minute read
about: payments, infosec
written in January, 2020. This is a less than 1 minute read
written in January, 2020. This is a 2 minute read
about: cycling, udaipur