0

I have a folder of PDF documents that I want to strip the first page off. I have found a tool that does this from the command line and this works successfully.
This is the command that I am using:

pdftk 1.pdf cat 2- output 1_Stripped.pdf

where 1.pdf is the original filename, and I have 1_Stripped.pdf as the output file.

It will take me forever to do this for each file, I'm sure that within DOS there must be a way of looping around every file in the directory and doing that command for them. (Passing in the filename automatically and then having the output as having "_Stripped" at the end. But I'm struggling to do it.

I thought that this would do the trick:

for file in *.pdf 
    pdftk "$file" cat 2- output "$file"stripped;
done

but I'm just getting error messages.

Could anyone point me in the right direction?

Jongware
  • 22,200
  • 8
  • 54
  • 100
Zoe
  • 1
  • Can you [edit] your post and add the error messages you are getting? – Jongware Jul 14 '15 at 10:09
  • Here is an older question that has been answered: http://stackoverflow.com/questions/39615/how-to-loop-through-files-matching-wildcard-in-batch-file – rcc Jul 14 '15 at 10:12
  • Thanks, I have resolved now, with this FOR %i IN (*.pdf) DO pdftk %i cat 2-end output "stripped/"%i"_stripped.pdf" – Zoe Jul 14 '15 at 11:07

0 Answers0