I recently found this very helpful link to count the pages in a large folder full of PDF files:

It worked like a dream. Now, however, I need to do the same for a folder full of Word files. Does anyone know how I change the script provided in that link to do that? Or is there some other utility that I can use?

  • Well, I have some Word documents from which I can extract the page number with the following command, but I also have some on which the following bash command does not work: cat some.doc | egrep -o 'page (\d+)' | tail -1 | cut -d ' ' -f2 – fabianegli May 30 '19 at 15:48
  • There is a command line application called "wv", once installed it provides a command called "wvSummary that should get you the page counts that you are looking for. "wv" can be installed using MacPorts or (probably) HomeBrew. See here for more info on "wv": askubuntu.com/questions/305633/… – Chris Norman May 30 '19 at 17:58
  • Thank you fabiannegli and Chris. I will look into those options. I did get a little joy on some of the .doc files using the Windows OS. But the vast majority of files did not seem to expose the page numbers to view in that manner. – David Larsen Jun 3 '19 at 9:24

The AppleScript in the linked page queries Spotlight's metadata to get the page count for each PDF document. (Specifically, the kMDItemNumberOfPages value.)

It's up to applications to provide metadata to Spotlight, and MS Word doesn't provide page numbers to Spotlight.

So you can't change the script easily, and will need another method.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .