- #!/bin/sh
- if [ $# -lt 1 ] ; then
- echo "Usage: $0 PDF-NAME"
- exit 1
- fi
- OLD_NAME=$1
- FILE_SLUG=$(pdfinfo $OLD_NAME | grep Title | cut -d: -f 2 | sed 's/ *$//g' | sed 's/^ *//g' | tr 'A-Z' 'a-z' | tr ' ' '-')
- if [ ! -z $FILE_SLUG ] ; then
- mv $OLD_NAME ${FILE_SLUG}.pdf
- else
- echo Cannot detect title
- fi
|