Combines PDFs based on file name?

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

Moderator: Mr_Noodle

Combines PDFs based on file name? Mon Jan 09, 2017 6:37 pm • by brizzle
I have billing documents that are named in the following fashion:

Smith 1.pdf
Smith 2.pdf
Smith 3.pdf
Johnson 1.pdf
Johnson 2.pdf
Johnson 3.pdf

How would I go about getting Hazel to combine these into single PDFs that result in just Smith.pdf and Johnson.pdf?

Thanks!
brizzle
 
Posts: 2
Joined: Wed Dec 07, 2016 1:27 am

Re: Combines PDFs based on file name? Tue Jan 10, 2017 11:50 am • by Mr_Noodle
That will definitely require scripting as Hazel doesn't have any built-in actions to combine files. There might even be an Automator action for that.

The tricky part is that rule are made to only match a single file or folder at a time. You'll have to figure out conditions such that it matches one of them, and have the script/workflow that combines the pages know how to get the other ones.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Combines PDFs based on file name? Thu Jan 12, 2017 1:32 am • by brizzle
I have an Automator action that I think will work. Possibly even a script. I found them both online.

However - do you have advice on how to tell Hazel to look in each separate PDF for Smith or Johnson and then combine those? Would I have to write a separate rule for each last name? Or could I import a list of names somehow?
brizzle
 
Posts: 2
Joined: Wed Dec 07, 2016 1:27 am

Re: Combines PDFs based on file name? Thu Jan 12, 2017 3:54 pm • by Mr_Noodle
You could use pattern matching (search the help for "match patterns") to search for a word followed by a space and the number 1. That would match up against the first file. You can then have the Automator action somehow then figure out the rest of the files needed to combine with that first one.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support