I found this neat command to merge multiple PDF into one, using Ghostscript:
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf
<
I used the following code with success on iOS terminal to compress multiple PDFs recursively. I posted it because I couldn't find something that worked for me with a simple copy and paste.
find . -name '*.pdf' | while read pdf; do gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile="${pdf}_new.pdf" "$pdf"; done
Note you may want a different output quality, sou you can change the -dPDFSETTINGS parameter as follows:
-dPDFSETTINGS=/screen: lower quality, smaller size.
-dPDFSETTINGS=/ebook: for better quality, but slightly larger pdfs.
-dPDFSETTINGS=/prepress: output similar to Acrobat Distiller "Prepress Optimized" setting.
-dPDFSETTINGS=/printer: selects output similar to the Acrobat Distiller "Print Optimized" setting.
-dPDFSETTINGS=/default: selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file.