Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
pdftk_path="/usr/local/bin/pdftk" # full path to pdftk binary
pdf_infokeys="~/pdf-infokeys" # full path to file containing new metadata
pdf_search_path="/var/www/html" # path to search for pdf files
pdf_temp_path="/tmp" # temporary directory
for i in $( find $pdf_search_path -type f -name "*.pdf" ); do
cp $i $pdf_temp_path/temp.pdf
$pdftk_path $pdf_temp_path/temp.pdf update_info $pdf_infokeys output $i
rm $pdf_temp_path/temp.pdf
done
IFS=$SAVEIFS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.