Skip to content

Instantly share code, notes, and snippets.

@sepastian
Created March 19, 2025 20:12
Show Gist options
  • Save sepastian/dc8dfebf740f4423c37f0fd097a70df9 to your computer and use it in GitHub Desktop.
Save sepastian/dc8dfebf740f4423c37f0fd097a70df9 to your computer and use it in GitHub Desktop.
Append PDF files one by one
# Find PDFs, for example in sorted order,
# using https://gist.github.com/sepastian/5a39eb7aff7adcf2ba2460ca0738664a
find -type f -name '*pdf' | \
while read f
do
# Append file 2 ... N
if [ -f all.pdf ]; then
~/go/bin/pdfcpu merge -m append all.pdf "${f}"
continue
fi
# Copy first file
cp "${f}" all.pdf
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment