Sub file/folder count vs number of items

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

Moderator: Mr_Noodle

Sub file/folder count vs number of items Mon Apr 02, 2012 3:55 pm • by medusa
Hi,

I have just been trying to create a simple rule to delete backups from my Omnifocus backups folder using Hazel 3.0.

I wanted to delete any backups older than 10 days but also wanted to ensure I had a minimum of 10 backups.

I thought the first step would be to count the number of sub files/folders in my Omnifocus folder and so setup a rule where sub file/folder count is greater than 10. However, for some reason I could not get this basic step to work. Not one file in the folder was checked.

I have been able to get around this by using the spotlight "number of items" attribute where the number of items is greater than 10.

However, my question is, what was I doing wrong with the sub file/folder count? And what is the difference between this and using the spotlight number of items attribute.

Thanks!

Keith
medusa
 
Posts: 3
Joined: Wed Aug 04, 2010 7:59 am

Re: Sub file/folder count vs number of items Mon Apr 02, 2012 5:01 pm • by a_freyer
The reason that this doesn't work the way you expected is that this particular rule only applies to folders, since files cannot have any "subfiles or subfolders."

This will do what you're looking for though:

Code: Select all
If (All) of the following...
     Date Added IS NOT IN THE LAST 10 days
     Date Added IS NOT AMONG THE 10 most recent

Then
     Move to TRASH
     


________________

Edited to correct typo cited by Mr_Noodle below.
Last edited by a_freyer on Mon Apr 02, 2012 5:10 pm, edited 1 time in total.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

I think the help has a note about it but the Subfile/folder Count was added because Spotlight's Number of Items also counts invisible files (like .DS_Store) which screws up how useful it is since you usually don't know whether that file is there or not.

That said, a_freyer's solution does what you want without checking the file count. Just to clarify, though, "is not among the last 10" should be "is not among the 10 most recent".
Mr_Noodle
Site Admin
 
Posts: 7364
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Sub file/folder count vs number of items Mon Apr 02, 2012 5:11 pm • by a_freyer
Mr_Noodle wrote: Just to clarify, though, "is not among the last 10" should be "is not among the 10 most recent".


Corrected. Thanks.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Sub file/folder count vs number of items Mon Apr 02, 2012 6:14 pm • by medusa
a_freyer wrote:
Code: Select all
If (All) of the following...
     Date Added IS NOT IN THE LAST 10 days
     Date Added IS NOT AMONG THE 10 most recent

Then
     Move to TRASH
     



Ah, I see. Thanks for the directions, will give that a try.

Very much appreciated.

Keith
medusa
 
Posts: 3
Joined: Wed Aug 04, 2010 7:59 am

Re: Sub file/folder count vs number of items Mon Apr 02, 2012 6:16 pm • by medusa
Mr_Noodle wrote:I think the help has a note about it but the Subfile/folder Count was added because Spotlight's Number of Items also counts invisible files (like .DS_Store) which screws up how useful it is since you usually don't know whether that file is there or not.


Excellent, makes perfect sense. That's certainly a useful distinction.

Thanks!

Keith
medusa
 
Posts: 3
Joined: Wed Aug 04, 2010 7:59 am

Re: Sub file/folder count vs number of items Sun May 13, 2012 5:02 pm • by bemental
Worked like a charm. Thanks for the tip.

Also, how awesome is it that the developer is still contributing and pumping out updates and new features? I wish I could purchase it again just to give him more money.
Yes, I'm a real person.
flavors.me/bemental
bemental
 
Posts: 3
Joined: Sat Apr 02, 2011 11:11 am

Aw shucks. Well, technically, you can purchase it again but keep your money. I'd rather have you spreading the word to other people.
Mr_Noodle
Site Admin
 
Posts: 7364
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Sub file/folder count vs number of items Wed Dec 25, 2013 11:24 am • by Loyd
Hello all,

I manage to get it work correctly but only through two rules (please see the two rules below)
1st Stage :
Code: Select all
If (All) of the following...
     Date Last Modified IS NOT IN THE LAST 10 days
     Name CONTAINS OmniFocus

Then
     Move to TRASH


2nd Stage :
Code: Select all
If (All) of the following...
     Date Last Modified IS NOT AMONG THE 15 most recent
     Name CONTAINS OmniFocus

Then
     Move to TRASH


I am new to Hazel and I'm about to try to understand the logic behind this wonderful software. Can someone help me understand why I have to go through two rules instead of one as indicated in the "a_freyer" post ?

Please note that using "Date Added" never works for me.

Great thanks in advance.
Loyd

Hazel 3.2.3 (1077)
OS X 10.8.5
Loyd
 
Posts: 9
Joined: Fri Nov 15, 2013 5:42 pm

The original should work. I suggest checking the preview to make sure the dates are what you expect since that is one aspect which you are doing differently.
Mr_Noodle
Site Admin
 
Posts: 7364
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support