This one liner (split into 2 lines for ease of reading) was tested and works well on my system:
find . -name '*.pdf' -type f -exec bash -c \
'pdftk "$0" cat 3-10 output "${0%.pdf}_3-10.pdf"' {} \;
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:
- Traverse all of the sub-folders and identify all the pdfs
- Extract pages 3-10 from each (using your example command)
- Give a sensible output filename: the original name with
_3-10
added
And 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:
find . -name '*.pdf' -type f -exec bash -c \
'pdftk "$0" cat 3-10 output "~/extracted/${0%.pdf}_3-10.pdf"' {} \;
And thus all of the altered pdf files would appear in ~/extracted
.
Endless possibilities :).