is there a way to filter out all pds in a folder that have more than 30 pages like qpdf --pages *.pdf and when a documant have more than 30 pages, then extract only the first and last page and generate a new pdf with the first and last site of bevore created pdfs? thx
Asked
Active
Viewed 200 times
-2
-
What have you tried so far? What is the exact problem? Are you looking for a tool? – Marcell Jan 25 '19 at 10:59
1 Answers
0
According to the manual, --show-npages
is used to count the pages and should output just the number. Use a for /f
loop to catch it into a variable. Put another for
around to process each PDF:
@echo off
for %%F in (*.pdf) do (
for /f %%A in ('qpdf --show-npages "%%f"`) do (
if %%A gtr 30 (
qpdf "%%F" --pages 1,r1 -- "%%~dpnF-firstlast.%%~xF"
)
)
)
(completely untested, because all I know of qpdf
is the manual, I just found)

Stephan
- 53,940
- 10
- 58
- 91