Page 1 of 1

Identifying bookmarked PDF files

PostPosted: Thu Mar 14, 2019 6:16 am
by Dellu
I am trying to identify PDF files that have bookmarks from the ones without bookmarks.

I find the script cpdf come closest to what I want to do. It has a feature that lists bookmarks.

If I run
Code: Select all
cpdf -list-bookmarks myfile.pdf
in the terminal, it generates two types of results:

(a) empty: if there is no bookmark
(b) list of bookmarks.


Now, I am trying to use grep the logs (results) and then output the result to Hazel.

Code: Select all
marks=$(cpdf -list-bookmarks "$1")
list=`grep -l "$marks"*.log`
if [ $? -eq 0 ]
then
    /bin/rm $list
fi


Can you guys help me what went wrong?

Re: Identifying bookmarked PDF files

PostPosted: Thu Mar 14, 2019 11:03 am
by Mr_Noodle
What kind of error are you getting in Hazel? Have you tested the full script outside of Hazel? Is this script being used in a condition or action?