Running Rules Only if Number of Documents Reached?

Posted:
Mon Oct 12, 2020 2:04 pm
by Uhlhorn
I want to run a rule only when the folder contains more than 10 files like this:
- Code: Select all
If the folder contains more of 10 files
delete files older than 1 month
end if
Can I do this with Hazel?
Re: Running Rules Only if Number of Documents Reached?

Posted:
Tue Oct 13, 2020 10:33 am
by Mr_Noodle
If you want to do that exactly, you'd need to do the following:
- Monitor the folder containing the folder in question.
- Have a rule to go into that subfolder (see chapter in the manual on this topic)
- Have a rule to delete files older than 1 month at that particular level in the folder hierarchy.
An easier way to do something similar is something like:
Date added is not among the 10 most recent, move to trash.
That will match the files that are not among the 10 most recent. Note that the files can be younger than a month but it will still only keep the 10 most recent files.