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

<< < (2/3) > >>

Another way to crack this could be to use SysExporter - see SysExporter - (Screen-scraping) Export data from Windows controls - Mini-Review
You could then drop the PDF files' details (including page counts) into Excel and perform arithmetic or other operations - whatever you wanted to do with the data.
For example, you could copy this sort of data into Excel, from Windows Explorer (I'm using xplorer² in this screenshot clip):

You could have a filtered view of all the PDF files in a set of nested directories this way, displayed as a flat file in xplorer², and turf all that data into Excel as a table, using SysExporter, together with (say) the file path data. It would effectively be a snapshot database index of all your PDF files in that set of nested folders, with the metadata being whatever you had chosen as display columns for (say) file properties - e.g. including "Pages".
You could select any data from the Excel table and (say) feed it in to batch files as parameters.

Thank you all for your input! 4wd, your solution worked great! I only had to tweak it slightly to make it do exactly what I wanted. Here's the code I ended up using:

--- Code: Text ---REM [email protected] offdel output.txtfor /r %1 %%f in (*.pdf) do pdfinfo.exe -meta "%%f" >out.txt & echo %%~nxf,| tr.exe -d "\r\n" >>output.txt & find "Pages:" out.txt | tr.exe -d "\055\056\072[:alpha:][:space:]" >>output.txt & echo. >>output.txtdel out.txt
I just changed the output file name so that it would only include the file name instead of the full path, and I deleted the quotes around the file name and the space after the comma so that Excel would handle it more easily. These are obviously minor tweaks. I also realized that a comma might not be the best delimiter here because file names can include commas, too. But that would be easily fixed if I needed to.

Of course, we could also use TR to extract the other fields (if we wanted to), but this is a great solution for me! TR seems very powerful. I haven't had much use for GNU commands before. Now I have some new stuff to play with!

Thank you!

IanB, that sounds like a nifty solution, but I was hoping for something I could use without having to install anything.

x16wda, sure, GREP would work, too.

You could also use my PDFInfoGUI application:

skwire, thanks for playing the trump card!  :Thmbsup:

Export CSV button? Check.
Folder recursion? Check.
Custom PDF file list? Check.
Separate fields for path and file name? Check.
Full document properties? Check.

Best tool I've found this month! Had to come to the experts to find it, though.


Right on.  =]  BTW, welcome to the DonationCoder site and enjoy your stay.  =]


[0] Message Index

[#] Next page

[*] Previous page

Go to full version