Come unire più pdf tramite terminale mac

Mac OS X: How to merge pdf files in a directory according to their file names


https://www.pdflabs.com/tools/pdftk-server/

Try pdftk. It is command-line software that can join PDF files (and do lots of other stuff, too, but that isn't relevant here). You can download it from the official pdftk web page.
Sample syntax:
pdftk old1.pdf old2.pdf old3.pdf cat output new.pdf
will create the file new.pdf that contains the concatenation of the files old1.pdfold2.pdfold3.pdf.
To solve your problem, with your example filenames:
pdftk 1000.*.pdf cat 1000.pdf
pdftk 2000.*.pdf cat 2000.pdf
and so on. You can use shell scripting to make this completely automatic if desired (but you'll have to spend a little time on your own learning how to write shell scripts).

Assuming all files are named 1000.x, 2000.x etc. a shell script could look somehow like this
#!/bin/bash

for n in {1..9}; do
    if [[ -r ${n}000.1.pdf ]]; then
        rm -f ${n}000.pdf
        pdftk ${n}000.*.pdf cat ${n}000.pdf && mv ${n}000.*.pdf ~/.Trash/
    fi
done

Commenti

Post popolari in questo blog

Comando SCP

Tutorial: come usare alcuni servizi e la posta di iCloud su Snow Leopard