Context: Catalina = zsh (preferred) or 16.04 Ubuntu = bash
A qpdf
example indicates:
# To merge (concatenate) all the pages of a list of PDF files and save the result as a new PDF:
qpdf --empty --pages <file1.pdf> <file2.pdf> <file3.pdf> -- <output.pdf>
A set of .pdf files (with spaces in filenames), in a particular directory, are to be concatenated:
# Concatenate Drafts file to ../concatDrafts.pdf (76 pdf files)
# https://stackoverflow.com/a/53754681/4953146
qpdf --empty --pages *.pdf -- out.pdf
Although qpdf
command is concatenates .pdf files, the reverse order of the .pdf files is to be concatenated. The order of the files to be processed is returned by:
ls -r.pdf
To handle spaces in the .pdf file names: xargs research indicates the need for:
ls -r *.pdf | xargs -E '\n'
What is the the thought process to arrive at a command the pipes the output of ls into the qpdf
command?
ls
" link. :) – Kamil Maciorowski Nov 01 '20 at 17:31