Rename PDF to first line of text using Hazel

I have HUNDREDS of PDFs that have the same basic internal structure, the top line of text (sometimes two) is the title of the document. Unfortunately, their file naming system is chaotic.

How can I rename each file using its top line of text?

1 Like

You should be able to use a Hazel rule with [Contents][Contain Match] to match up to a certain similar line break or ending punctuation pattern in the PDF contents, then tokenize the titles in the PDF and use the file rename action employing the text tokens saved in the previous rule.


I forget the name of the verb but in a PDF the text is wrapped in round brackets and this verb attached. I would throw it into a text editor to get the actual pattern. Then code to match that.