Help with file match and delete in nested folders?

Posted:
Tue Jan 14, 2025 12:56 pm
by deadrubberboy
Hello!
I use Calibre to convert ebooks from (epub, mobi, azw3, etc) to .kepub for use on Kobo Reader.
The files are in /drive/books/author name/bookname/ebook files
I would like to have Hazel monitor (or run once a night etc) and:
IF .kepub exists delete the "epub, mobi, azw3, etc" files.
The files will have the same name and only the extension changes on conversion.
I'm having trouble getting any rules to match or find the files.
Thanks for any help or advice on how to proceed.
Re: Help with file match and delete in nested folders?

Posted:
Wed Jan 15, 2025 9:48 am
by Mr_Noodle
You'll need to use a nested condition like the following:
- Code: Select all
If (all) are met
Extension is epub
If (all) are met for (any file in the same folder)
Name matches (name)
Extension is kepub
The above will match an epub when there's a kepub file with the same name in the same folder. You can extend this as needed to handle the other cases.
Re: Help with file match and delete in nested folders?

Posted:
Wed Jan 15, 2025 12:36 pm
by deadrubberboy
Mr_Noodle wrote:You'll need to use a nested condition like the following:
- Code: Select all
If (all) are met
Extension is epub
If (all) are met for (any file in the same folder)
Name matches (name)
Extension is kepub
The above will match an epub when there's a kepub file with the same name in the same folder. You can extend this as needed to handle the other cases.
Thank you!
Will this search in sub folders? IE. I make the rules in the top /books folder and it looks in the existing and future added books/author/booktitle folders?
Re: Help with file match and delete in nested folders?

Posted:
Wed Jan 15, 2025 12:57 pm
by deadrubberboy
Mr_Noodle wrote:You'll need to use a nested condition like the following:
- Code: Select all
If (all) are met
Extension is epub
If (all) are met for (any file in the same folder)
Name matches (name)
Extension is kepub
The above will match an epub when there's a kepub file with the same name in the same folder. You can extend this as needed to handle the other cases.
Clearly I'm doing something wrong. I have many other rules moving files based on extension etc from the same drive... For some reason this one is not working.
When I use the "rules test" I can't even get a green check on "extension is epub". I tried "kind is EPUB" I tried with and without the leading "." - it just won't see it. If I change it to "any file" I get green check. Otherwise I'm all Red X's.
Re: Help with file match and delete in nested folders?

Posted:
Thu Jan 16, 2025 9:32 am
by Mr_Noodle
Can you post a screenshot of the preview with the extension not matching? Note that you can't upload images here so if you don't have your own cloud service for posting stuff, you can use imgur.com.