The name of the file will be the name of the folder even if

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

Moderator: Mr_Noodle

Hello,

I'm having trouble using the conditions.

I try to change the name of a file by taking the name of the folder where it is located.
Image
With this rule it works, but I'm afraid that Hazel won't stop running.

So I would like to put an additional condition, which would check the name of the folder and if it is not the same as the file then the name of the file will be changed.

But I can't find a way to get the name of the folder in order to do the verification. If I add conditions I can't validate them all...
Image

Thanks for help.
hercut
 
Posts: 57
Joined: Fri Dec 17, 2021 11:44 am

I'm not quite sure what you are doing here. Is there only one file in that folder? If not, you will end up with a bunch of duplicate file names. Also, not following the logic of your second version. A file cannot be a Folder and Text at the same time.

It might help if you give a detailed example of what you want to happen.
Mr_Noodle
Site Admin
 
Posts: 11867
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thank you for your answer,
You confirm me that my first rule besides not having put a condition other than "kind text" (which seems to me ok, given that I will never have another .txt file than the one I want to work on) will go in circles and rename my file without stopping? it will do it only once? It is better to put a condition that will stop the process with another condition?
I have a folder (client) with inside folders named with name and surname with inside folders and file and only one .txt file.
It is the latter (.txt) that I want to rename as the name of the folder with the name and surname of the client.
But, this one can be brought to change nomenclature, therefore I would like that this .txt changes name automatically in case of future modification.

Image
hercut
 
Posts: 57
Joined: Fri Dec 17, 2021 11:44 am

The issue is you have both Kind is folder and text. Nothing will match both conditions. You can use Kind is Document if you want to match non-folder files. It's also a good idea to have a condition to prevent it matching again, like checking to see if it's named properly.
Mr_Noodle
Site Admin
 
Posts: 11867
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:The issue is you have both Kind is folder and text. Nothing will match both conditions. You can use Kind is Document if you want to match non-folder files. It's also a good idea to have a condition to prevent it matching again, like checking to see if it's named properly.



How can I check that it has the right name, knowing that I don't have a condition on the name of the file?

That's the main problem, how to check that the file name is the same as the folder name?
hercut
 
Posts: 57
Joined: Fri Dec 17, 2021 11:44 am

You can use match patterns to do that. Or you can set a tag on it and check that for that tag.
Mr_Noodle
Site Admin
 
Posts: 11867
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support