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

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.

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...

Thanks for help.
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.

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...

Thanks for help.