I have 90 sub-folders in a folder. Each sub-folder contains pdf files. Total pdf files are nearly 2200. How can I extract page number 3 to 10 from all pdfs?
To extract the pages from one pdf, I am using the following command.
pdftk *.pdf cat 3-10 output 3-10.pdf
This one liner (split into 2 lines for ease of reading) was tested and works well on my system:
Simply open a Terminal window in the base folder (the one that contains all of the sub-folders) and copy and paste the entire one line command given above. It will:
_3-10
addedAnd this should neatly and economically accomplish your purpose...
Variation:
Optionally you could give a different output location to collect all of the altered pdf documents. For example you could create a folder called
~/extracted
and alter the commandline above to the following:And thus all of the altered pdf files would appear in
~/extracted
.Endless possibilities :).
You can use qpdf as pdftk is not available on ubuntu bionic by default any more:
find . -name '*.pdf' -type f -exec bash -c 'qpdf --empty --pages "$0" 3-10 -- "temp/${0%.pdf}_1.pdf"' {} \;
This will put the new pdf's into temp folder.