Page 1 of 1

Renaming file and the folder containing it at the same time

PostPosted: Sun Dec 10, 2017 9:48 am
by Anjadekar
I have created a renaming rule such that files/folders in the format Prefix.Date.Suffix are renamed to Prefix-Date-Suffix and then moved to a folder.

This rule works fine except in instances where a folder within the monitored folder and the file within it both have the same name. For example, if I have a folder named "Hi.17.12.23.Bye" and a file named "Hi.17.12.23.Bye.txt" within it then, based on how I have placed the Process subfolders rule, either the folder or the file are renamed. I would like for both to be renamed at the same time instead of in different passes, which does happen. I have played around with a ton of different options but can't get this to happen. Here is my rule. Thanks for your help!

https://www.dropbox.com/s/rkj640nlcz17p ... rules?dl=0

Re: Renaming file and the folder containing it at the same t

PostPosted: Mon Dec 11, 2017 12:14 pm
by Mr_Noodle
I suggest going through the troubleshooting guide here: https://www.noodlesoft.com/kb/hazel-tro ... ing-guide/

Also, I'm not sure if it's intended but if the folder matches the second rule, that folder will get moved to the transfer folder. It may cause a conflict since it will have the same name as the file within it, which will also end up there.

Re: Renaming file and the folder containing it at the same t

PostPosted: Mon Dec 11, 2017 2:14 pm
by Anjadekar
Thanks for your reply. I did go through the Troubleshooting Guide but it didn't resolve the issue. The thing is that the folder is getting moved to the Transfer folder but either one of two things is happening (depending on the order in which the Process Subfolders rule is placed).

1. The folder gets renamed to Hi-17.12.23-Bye but the name of the file within it continues to be Hi.17.12.23.Bye.txt
2. The folder does not get renamed (continues to be Hi.17.12.23.Bye) but the file within it is renamed to Hi-17.12.23-Bye.txt.

As I said earlier, which of these two ends up happening is based on the order of the Process Subfolders rule and also the Continue matching rules condition within it.

If I run the rule a second time the unnamed folder/file do get renamed but I would like that to happen in the first go itself, like so:

1. The folder should get renamed to Hi-17.12.23-Bye
2. The file within it should get renamed to Hi-17.12.23-Bye.txt
3. The folder should get moved to the Transfer folder

I hope I'm not describing this in a confusing way and thanks for your help.

Re: Renaming file and the folder containing it at the same t

PostPosted: Tue Dec 12, 2017 12:36 pm
by Mr_Noodle
The problem is if the folder is moved before the file within is processed, then the file within is not processed since the folder is no longer underneath the monitored folder. The way you have the 2nd rule setup, it will move both the file and folder to the transfer folder, which, based on your description, is not what you intend.

What you want to do is a bit tricky, but have a rule just rename, not move anything. Then have another rule which detects if the folder and the file within (see nested conditions on how to do this in one rule) have the proper format and then move it.

Re: Renaming file and the folder containing it at the same t

PostPosted: Tue Dec 12, 2017 4:01 pm
by Anjadekar
I tried breaking up the rules so as to have one for renaming and one for moving, as you suggested. I haven't gotten around to the Move rule yet as I am having trouble with the renaming step. I can get either the file or the folder to rename in the same instance (depending on the placement of the Process Subfolders rule and the Continue matching rules condition within it.)

I'd like to resolve this bit first so could you please show me how I can get both the folder and the file to be renamed? Thanks.

Re: Renaming file and the folder containing it at the same t

PostPosted: Wed Dec 13, 2017 11:18 am
by Mr_Noodle
Can you post the logs?

Re: Renaming file and the folder containing it at the same t

PostPosted: Wed Dec 13, 2017 12:33 pm
by Anjadekar
Sure. Can I email them to you and then can we continue the conversation here?

Re: Renaming file and the folder containing it at the same t

PostPosted: Thu Dec 14, 2017 11:22 am
by Mr_Noodle
Sure. Email them in to support and I'll take a look.

Re: Renaming file and the folder containing it at the same t

PostPosted: Fri Dec 15, 2017 8:29 am
by Anjadekar
I've emailed the logs to you. Thanks!