Identifying bookmarked PDF files

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Identifying bookmarked PDF files 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?
Dellu
 
Posts: 17
Joined: Thu Dec 12, 2013 6:26 am

Re: Identifying bookmarked PDF files 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?
Mr_Noodle
Site Admin
 
Posts: 11235
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support