I have a directory foo containing .pdf files named with pattern X01, X02, ..., each two pages long. I want to combine them to a new .pdf, named "all_YY-MM-DDTHHMMSS.pdf" that will contain the file names as bookmarks.
I used these two commands. While the first one works well,
$ gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dAutoRotatePages=/None -sOutputFile=all_$(date +"%FT%H%M%S").pdf X*.pdf
the second one, based on this answer fails.
$ pdftk all_2023-07-12T094706.pdf update_info {ls | grep X*} output out.pdf
grep: X}: No such file or directory
grep: output: No such file or directory
grep: out.pdf: No such file or directory
Done. Input errors, so no output created.
I was trying to grep the ls for the filenames starting with X*, in order to exclude the new combined .pdf names all....
How do I get this to work, preferably by adding update_info to the first command?
I'm aware of solutions like this, but they look rather tedious.