Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Have been looking around and cannot find a simple automator solution to copy info of a pdf's filename to the pdf's author and title metadata. Many solutions are built upon pdftk, but that util doesn't seem to be available for the mac anymore.

Any suggestions? I am not interested in Calibre and similar, I need an automator workflow that I can use in the Finder.

share|improve this question

closed as off-topic by Mokubai, Tog, Excellll, Moses, ncdownpat Oct 31 '13 at 1:50

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking product, service, or learning material recommendations are off-topic because they tend to become obsolete quickly. Instead, describe your situation and the specific problem you're trying to solve. Here are a few suggestions on how to properly ask this type of question." – Mokubai, Tog, Excellll, Moses, ncdownpat
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

You can install pdftk on OS X by using the installer from http://www.pdflabs.com/tools/pdftk-server/.

This adds (filename.pdf) to the end of the author and title:

for f in *.pdf;do pdftk "$f" dump_data_utf8|awk -v "f=$f" '/InfoKey: (Author|Title)/{print;getline;sub(/$/," ("f")")}1'|pdftk "$f" update_info_utf8 - output "new_$f";done

This updates the title:

echo $'InfoKey: Title\nInfoValue: new title'|pdftk input.pdf update_info_utf8 - output output.pdf

Another option is to use exiftool:

brew install exiftool;for f in *.pdf;do author=$(exiftool -p '$Author' "$f");title=$(exiftool -p '$Title' "$f");exiftool -Title="$title ($f)" -Author="$author ($f)" -overwrite_original "$f";done

share|improve this answer
    
Ok, didn't know about exiftool; great will bake a workflow out of it! –  user267985 Oct 30 '13 at 15:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.