jw013 wrote:If you use either of the suggested command snippets it should work. It really is that simple, no need to play around with scripting. The only possible issues arise if any of the file names in your list have problematic names (contain shell characters, spaces, etc). Can you be more specific as to what you are seeing that is not working?
Thanks for all of your inputs!
I have created created a test input file; list.txt, which contains:
Code: Select all
$ cat list.txt
pdf1.txt pdf2.pdf pdf3.pdf pdf4.pdf
And if I:
Code: Select all
$ pdftk $(< list.txt) cat output output.pdf
pdf1.txt not found as file or resource.
Error: Failed to open PDF file:
pdf1.txt
Errors encountered. No output created.
Done. Input errors, so no output created.
Now if I create an array with the contents of list.txt:
Code: Select all
$ array=(pdf1.pdf pdf2.pdf pdf3.pdf pdf4.pdf)
$ echo ${array[*]}
pdf1.pdf pdf2.pdf pdf3.pdf pdf4.pdf
Now inserting the array into the pdftk command:
Code: Select all
pdftk ${array[*]} cat output output.pdf
No errors, and the combined PDF, output.pdf is created.
I can get my results if I use an array. So I now if I fill my array with the contents of list.txt, this should work.