[How to] Automatically delete cover pages on downloaded PDFs

After a bit of puzzling around, I made a Hazel rule which will delete cover pages on downloaded PDFs files, with the help of the free PDFtk utility.
The key shell script is:
Maybe this will help some people on this forum. I've gone into some more detail on how the script works, plus linked a mirrored PDFtk installer, in a blog post: http://cai.zone/2017/07/hazel-rule-to-delete-researchgate-pdf-cover-pages/
The key shell script is:
- Code: Select all
path="$1"
name=$(basename "$path" ".pdf")
new_name="$name no cover page.pdf"
dir=$(dirname "$path")
pdftk "$1" cat 2-end output "$dir/$new_name"
Maybe this will help some people on this forum. I've gone into some more detail on how the script works, plus linked a mirrored PDFtk installer, in a blog post: http://cai.zone/2017/07/hazel-rule-to-delete-researchgate-pdf-cover-pages/