3

I have over 200 PDF files of various sizes. I estimate that it's about 200-250k pages. Is there a relatively simple way to determine the total page count for all of these files - combined- in MacOS?

Highlighting all -> Info generates a single window that does not provide the information.

My first thought was Preview - however it seems to be unable to open even a dozen or so together without running into problems (doesn't open each file (will open 9 of 10 for some reason?), crashes, etc.).

Saw How to count pages in multiple PDF files? however this is on Mac, and I'd really rather not duplicate and then merge all of the files..

Would appreciate your thoughts!

MacOS 10.12.6

Have Adobe Acrobat DC (so this is an option)

Gryph
  • 418

3 Answers3

4

There is a terminal command 'pdfinfo aa.pdf' which will print info, including the number of pages, of the file aa.pdf. You should be able to run this in batch mode with the output piped to a file. You can then use grep, awk, or sed to extract the word 'pages' from the file and get a table of the number of pages in each file.

You can also drag a file or many files onto the terminal to run this in batch mode.

Natsfan
  • 521
3

Paste this one-liner into Terminal to count page all numbers across all PDFs in the current folder:

for f in *.pdf; do pdfinfo $f | grep Pages | tr -d 'Pages:' ; done | paste -s -d+ - | bc

1

You can use cpdf (Mac OS X/Microsoft Windows/Linux) and iterate over all files in a directory using a 'for' loop.

To print the number of pages in one PDF:

cpdf -pages "my file.pdf"

From the terminal in Mac OS X or Linux, to print the number of pages in all the PDF files the current folder contains:

for f in *.pdf; do cpdf.exe -pages $f; done
Franck Dernoncourt
  • 24,246
  • 64
  • 231
  • 400