Skip to content

Instantly share code, notes, and snippets.

@udoyen
Last active June 28, 2019 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save udoyen/e706d5a675aaec5f75acd38b148114f9 to your computer and use it in GitHub Desktop.
Save udoyen/e706d5a675aaec5f75acd38b148114f9 to your computer and use it in GitHub Desktop.
How to merge pdf files using the pdfunite tool on linux
#!/usr/bin/env bash
set -e # Quit on first error
count=0
for i in ./*/*
do
my_array["$count"]="$i" # Creates an array with the filenames
((++count)) # Increase the array index
echo ${my_array[@]} # Echo the contents of the array
done
# Carryout the merge
pdfunite ${my_array[@]} merged_output.pdf
.
|-- 01
| `-- introduction-to-google-cloud-platform-slides.pdf
|-- 02
| `-- getting-started-with-google-cloud-platform-slides.pdf
|-- 03
| `-- virtual-machines-and-networks-in-the-cloud-slides.pdf
|-- 04
| `-- storage-in-the-cloud-slides.pdf
|-- 05
| `-- containers-in-the-cloud-slides.pdf
|-- 06
| `-- applications-in-the-cloud-slides.pdf
|-- 07
| `-- developing-deploying-and-monitoring-in-the-cloud-slides.pdf
|-- 08
| `-- big-data-and-machine-learning-in-the-cloud-slides.pdf
|-- 09
| `-- summary-and-review-slides.pdf
|-- merged_output.pdf
`-- merger.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment