15.6.13

concat pdf

I regularly use whatever websites come up when you google 'concat pdf' to merge multiple pdf files together but this is way easier! No more selecting 30-40 pdf documents! Also, this command doesn't regularly ask for money or label the pdfs with its watermark. Procore...

 #! /usr/bin/perl -w  
 my @pdfs = `ls -rt | grep .pdf`;  
 my @args = qw/gs -q -sPAPERSIZE=A4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf/;  
 chomp && push @args, $_ foreach ( @pdfs );  
 system( @args );