Convert & Combine Files, Then Move Based On Folder Name

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

Hi, I have been banging my head against the wall trying to figure this out. Hope someone can help me.

Situation:
I have a folder made up of a bunch of folders, and in each one are a number of images (TIFFs lets say).

End Result:
The images in each folder are converted to a single PDF. Then that PDF is named with the name of the containing folder (if that makes sense)

My Problem:
I can get Hazel to go in and convert each image to PDF with an Applescript; not a problem. I can have Hazel take a folder, run a Python script to combine all the PDFs in that folder into one, then rename it with the containing folder's name; again not a problem.

What I can't seem to figure out how to do is do both. If I have Hazel go into Subfolders with "Run Rules On Folder Contents", I can't seem to get it to then act on the folder itself. If I have Hazel not go into the subfolder, I can't have it name the resulting PDF to the folder's name and move it.

Other Things I've Tried:
I've tried a million combinations of Automator and Applescript solutions, and they all seem to get almost there, but not quite.

I can't help feeling that there is some really simple thing to do that I am totally missing, so hopefully someone in Hazel land can help. Thanks!

-Brooks
bduncan
 
Posts: 5
Joined: Sun Aug 08, 2010 11:59 pm

Try using the "Source folder" attribute in the rename action. I believe that should just give you the name of the containing folder.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:Try using the "Source folder" attribute in the rename action. I believe that should just give you the name of the containing folder.


Thanks, that was actually working fine. My problem was/is that I couldn't figure out how to both do a rule that does something to a folder and go into the folder to do stuff with the contents. It is almost like you can do one or the other but not both (not sure if I am making sense here).

Anyways, I ended up doing it with a big Applescript outside of Hazel and it seems to be working OK. Thanks though, love the product!
bduncan
 
Posts: 5
Joined: Sun Aug 08, 2010 11:59 pm

I guess it's not clear to me why, in your example, you'd need to do this but there's no reason why a rule couldn't match a folder and do something to the folder as well as use the "Run rules on folder contents" action. Maybe I'm missing what you are trying to do here.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Hey bduncan - Any chance you'd be willing to post your Applescript (which converts each image to PDF) or python script (which combine all the PDFs in that folder into one then rename it with the containing folder's name)? I'd like to do the same things...
AppleSuperlatives
 
Posts: 7
Joined: Fri Dec 31, 2010 6:51 pm

Sure, here is a link to the script. It's cobbled together from a number of sources but hopefully it helps you out.

http://cl.ly/101d392M3L232D011N2l

Let me know if you have any questions.
bduncan
 
Posts: 5
Joined: Sun Aug 08, 2010 11:59 pm

Does this script still work? I've tested with Yosemite and not sure how to run it on selected folders
freshlesh3
 
Posts: 5
Joined: Sun Oct 25, 2015 10:10 am

bduncan wrote:Sure, here is a link to the script. It's cobbled together from a number of sources but hopefully it helps you out.

http://cl.ly/101d392M3L232D011N2l

Let me know if you have any questions.



bduncan -- It's been a long time, if possible please refresh your converter script (original shared link is dead)
ginmn
 
Posts: 2
Joined: Mon Aug 30, 2021 11:56 pm


Return to Open Discussion

cron