Wednesday, August 12, 2009

Reset author to filename on a bunch of pdf files

This script will reset the author to metadata on all files in the current directory to be the same as the filename of the file. It will write new files to a sub directory (which should already exist) called fixed.

Quick hacky script to so that papers are index more sensibility on my Sony Reader.

for i in *.pdf
do
echo $i
echo "InfoKey: Author" > data.txt
echo "InfoValue: " $i >> data.txt
cat data.txt
pdftk ./$i update_info data.txt output ./fixed/$i
done

No comments: