Hey there,
I think there might be a couple reasons why you're having issues with the multiple conversions (I'll be kind
This code:
Code:
find *.pdf | pdftk *.pdf input_pw password output open_*.pdf; if [ "$?" != 0 ]; then *.pdf >> fail.txt
would change to this (keeping it relatively the same) and easy to read, versus less efficient
Code:
find . -name "*.pdf" |sed -e 's/\.pdf//' -e 's/^\.\///'| while read x; do pdftk ${x}.pdf input_pw password output open_$x.pdf; if [ "$?" != 0 ]; then echo ${x}.pdf >> fail.txt;fi;done
This more convoluted than it needs to be, but, hopefully walks you through the process better. Take the output from the find command (changed to specify the current directory and quote the found filenames to avoid system globbing (*) reading anything from your current directory), process it with sed to remove the extraneous beginning ./ and ending .pdf from each filename, then pump that to a while loop where you run your pdftk command. In that while loop you run your if-conditional to check and see if it worked, with an ending "fi" to close the if loop and a "done" to close the while loop when you're done processing pdf's
Hope that helps and is easier to understand than it was to explain
, Mike