Can't target the subfolder content?

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

Moderator: Mr_Noodle

Can't target the subfolder content? Tue Jun 23, 2020 12:57 am • by Medved
Guys, I need to perform a lot of the same actions with the files:
1) I have a TARGET FOLDER where is a ton of subfolders, each subfolder can have an unpredictable name, like man-with-apple-smiling and inside is an image file usually named like a 12347SomeLetters.jpg I need to take the folder name and add it to the image name to get construction like man-with-apple-smiling-12347SomeLetters.jpg
This only one issue for me to buying Hazel. I've downloaded a trial, trying to make this rule - but have no luck.
I'm thought that hazel can do this, but it looks like I can't address the image in the subfolder name.
Here is a Screenshot of my rule and file structure:
https://prnt.sc/t4qg2b
Could you please help me?
Medved
 
Posts: 2
Joined: Tue Jun 23, 2020 12:38 am

Re: Can't target the subfolder content? Tue Jun 23, 2020 10:41 am • by Mr_Noodle
Search the manual for "subfolders". There's a whole chapter there on how to get Hazel to go into subfolders. You will need to split up your rule into two rules, at least. The chapter explains why this is the case.

You'll also want to look up "match patterns" and "nested conditions". That will allow you to grab the parent folder name and apply that to the image file.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Can't target the subfolder content? Tue Jun 30, 2020 1:13 am • by Medved
read this all - but still have no idea, i can't get the subfolder name and rename the file inside that subfolders like {subfolder-name}-filename.jpg
Medved
 
Posts: 2
Joined: Tue Jun 23, 2020 12:38 am

Re: Can't target the subfolder content? Tue Jun 30, 2020 10:02 am • by Mr_Noodle
You'll need to tweak this but something like:
Code: Select all
If (all) are met
    If (all) are met for (the enclosing folder)
        Name matches (• parent name)

where •parent name is a custom attribute that matches (anything). That will capture the name of a file's parent folder into the •parent name.

You will also need a SEPARATE rule to go into subfolders.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support