Page 1 of 1

Convert & Combine Files, Then Move Based On Folder Name

PostPosted: Wed May 11, 2011 2:11 am
by bduncan
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

Re: Convert & Combine Files, Then Move Based On Folder Name

PostPosted: Wed May 11, 2011 9:36 am
by Mr_Noodle
Try using the "Source folder" attribute in the rename action. I believe that should just give you the name of the containing folder.

Re: Convert & Combine Files, Then Move Based On Folder Name

PostPosted: Wed May 11, 2011 3:36 pm
by bduncan
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!

Re: Convert & Combine Files, Then Move Based On Folder Name

PostPosted: Wed May 11, 2011 3:51 pm
by Mr_Noodle
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.

Re: Convert & Combine Files, Then Move Based On Folder Name

PostPosted: Wed Jul 13, 2011 11:33 pm
by AppleSuperlatives
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...

Re: Convert & Combine Files, Then Move Based On Folder Name

PostPosted: Thu Jul 14, 2011 10:00 am
by bduncan
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.

Re: Convert & Combine Files, Then Move Based On Folder Name

PostPosted: Sun Oct 25, 2015 12:38 pm
by freshlesh3
Does this script still work? I've tested with Yosemite and not sure how to run it on selected folders

Re: Convert & Combine Files, Then Move Based On Folder Name

PostPosted: Wed May 17, 2023 9:03 pm
by ginmn
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)