Renaming based on a parent folder

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

Moderator: Mr_Noodle

Renaming based on a parent folder Thu May 18, 2017 1:58 pm • by Colin
Please forgive me if this has been answered elsewhere, but I still can't figure it out. I'm trying to get a grip on dealing with subfolders (yes, I've read the user guide & sticky thread) and the 'subfolder depth' condition. What I'm trying to do, is rename files/folders based on a parent folder, but not necessarily the immediate parent folder:

Folder 1 > Subfolder 1 > Subfolder 2 > Subfolder 3

Currently I am able to rename Subfolder 3 adopting it's source folder (immediate parent) name (Subfolder 2) using 'Rename with pattern: source folder', but what I'd like to do is rename it based on Subfolder 1 or Folder 1, ideally only taking part of that folder's name. Is there a 'source folder depth' function I could use to call out which folder to reference the name from?

Here's a real-world example:
Image

What I'd like to get Hazel to do, is rename files & folders based on a portion of the ##-######.XXXXXX folder name.

So: (01-199606.Azusa > Photos > QSP Photos), would become (01-199606.Azusa > Photos > QSP Photos-Azusa]).

Is this possible? Is my request clear?

Thanks.
Colin
 
Posts: 10
Joined: Thu May 18, 2017 12:24 pm

Re: Renaming based on a parent folder Thu May 18, 2017 2:10 pm • by Mr_Noodle
I'm not following as I don't know what folder Hazel is monitoring or what Folder 1 or Subfolder 1 refer to. Could you clarify?
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Renaming based on a parent folder Thu May 18, 2017 2:41 pm • by Colin
Good question. I have Hazel monitoring the 'Locations' folder.
Colin
 
Posts: 10
Joined: Thu May 18, 2017 12:24 pm

Re: Renaming based on a parent folder Thu May 18, 2017 2:44 pm • by Mr_Noodle
You can try something like going up the folder tree. The depth of nesting of conditions is limited so at best you can only go a level or two up:
Code: Select all
If (all) are met for (the enclosing folder)
   If (all) are met for (the enclosing folder)
       Name matches (•ancestor folder name)


where (•ancestor folder name) is a custom text attribute set to match "anything". What the above does is grab the name of the folder two levels up. You can then use the custom attribute in your "Rename" action.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Renaming based on a parent folder Tue May 23, 2017 2:15 pm • by Colin
I'm not entirely following; can you explain how to set this up in Hazel?
Colin
 
Posts: 10
Joined: Thu May 18, 2017 12:24 pm

Re: Renaming based on a parent folder Wed May 24, 2017 11:14 am • by Mr_Noodle
Check out this section in the manual: https://www.noodlesoft.com/manual/hazel ... onditions/
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support