ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE. Software > Coding Snack Guidelines

Count Number of Pages in PDF Files

<< < (3/3)

Hi, I came across this post when I was searching for pdf page counter.  So, I thought of sharing it when I found a simple freeware, so that it would be useful for somebody in the future.

Thank you!

Thank you 4wd!!!

This greatly helped me. I'm now saving the script and binaries and dependencies into a zip for future use. I had also added a bit onto the batch to give me the file size in addition. Then when I open in Excel I'd convert it to kilobytes (as it is in bytes to begin with). Here is the script including file size:

--- ---REM PDF-Pages.cmd
@echo off
del output.txt
for /r %1 %%f in (*.pdf) do pdfinfo.exe -meta "%%f" >out.txt & echo "%%f", | tr.exe -d "\r\n" >>output.txt & find "Pages:" out.txt | tr.exe -d "\r\n\055\056\072[:alpha:][:space:]" >>output.txt & echo , | tr.exe -d "\r\n" >>output.txt & find "File size:" out.txt | tr.exe -d "\055\056\072[:space:][:alpha:]" >>output.txt & echo. >>output.txt
del out.txt

Perhaps a couple things to note when you are running the above script in a top-level directory containing 58,000+ PDF documents:

A. This will take a while :)

B. Prepare for cmd.exe to start consuming memory. We're up to 2.97 GB used by CMD.exe at the moment. I may have to let this run overnight instead.  :P

Sorry for bumping up this threat, but I'm struggeling with the following.
I want to display the total number of pages of the pdfs of the (sub)folders as wel. So not only the final total.

Something like:
c:\pdfs\path1 83
c:\pdfs\path2 12
c:\pdfs\path2\subfolder 3

Is that possible?


[0] Message Index

[*] Previous page

Go to full version