Sunday, April 14, 2013

Get page numbers of PDF files

This small script would list all PDF files in a folder along with the number of pages in each one of them.

a.py is nothing by the pdfid python script.


#!/bin/bash
for f in *.pdf
    do
    #echo $f
    pagenumber=`/usr/bin/a.py "$f" | grep "Page" | cut -de -f2`
    echo "$f    $pagenumber"
done

1.pdf                 5
2.pdf                 6
3.pdf                 7
4.pdf                 8
 

No comments:

Post a Comment