Count Pages In Pdf Files

Posted on by
Count Pages In Pdf Files

Please see, with a new script that provides subtotals by subfolder, which is what I really wanted when I wrote this one. Recently I’ve been trying to go paperless (well, mostly paperless) via a. (I’ll have more to say about the scanner in a future post). One way to go paperless is to just go from now forward—start scanning stuff and don’t worry about history. Shootout At Lokhandwala Background Theme Music Free Download. I decided that I’d go the other route, and work through our old paper files: some would be scanned and kept, much would just be recycled. The process went really quickly, compared to what I had expected. It helps that the Fujitsu is a wicked-fast document scanner!

PDF Page Counter may well be utilized to count the pages in PDF files speedily, PDF Page Counter supports all edition of PDF files, it is a stand-alone software and does not demand Adobe Acrobat set up inside your Windows system. PDF Page Counter is definitely an effortless to make use of PDF page count application.

But I was curious about how much I was scanning, in terms of total PDF pages—not files, but counting the pages in the files. Spotlight to the rescue; the field kMDItemNumberOfPages returns the number of pages in a document, and it seemed accurate in testing via mdls: $ mdls /path/to/somefile.pdf grep kMDItemNumberOfPages kMDItemNumberOfPages = 4 So I set out to write a script to traverse my “Scans” folder, and return the total number of PDF pages. This script is very simple—it’s got a basic error check to make sure there’s a value for kMDItemNumberOfPages, but other than that, it just spits out one line per file, showing the number of pages per file, and then a grand total at the end.

Here’s the script. IFS = $saveIFS Copy and paste into a new shell script, save it, and make it executable ( chmod 755 scriptname). Then, assuming you’ve saved it somewhere on your path, just execute it, and you’ll get a list of every file’s PDF page count, along with a grand total. If you’d rather see just the grand total, comment out the indicated lines. Note that it’s written specifically to look at PDFs, as shown in the myFiles line. Change that to look at other file types. A really fancy version of this script would provide totals by directory.