Page 1 of 1

File by how many times a file has been accessed?

PostPosted: Fri Oct 27, 2023 8:12 am
by Omission1278
I'm thinking about buying Hazel, but I don't think it can duplicate my manual filing.

My system is to order my downloads directory by recent, and then only keep stuff that I've accessed THREE TIMES or MORE.

The thing is, I don't think anything records how many times a file has been accessed, so I have to do it from memory.

I'm not even sure if MacOS tracks this, so Hazel would have to monitor the DATES accessed and see when they change.

Re: File by how many times a file has been accessed?

PostPosted: Mon Oct 30, 2023 9:39 am
by Mr_Noodle
Spotlight does sometimes record the last used dates as a list. It's under the kMDItemUsedDates key. You might be able to write a script to dump the Spotlight metadata with 'mdls', look for that field and process it accordingly.

Re: File by how many times a file has been accessed?

PostPosted: Mon Oct 30, 2023 12:09 pm
by Omission1278
Mr_Noodle wrote:Spotlight does sometimes record the last used dates as a list. It's under the kMDItemUsedDates key. You might be able to write a script to dump the Spotlight metadata with 'mdls', look for that field and process it accordingly.


It seems sometimes not enough, but thanks for the lateral thinking :-) I just get

Code: Select all
➜  Teach mdls */*.pdf |grep kMDItemUsedDates
kMDItemUsedDates                       = (
kMDItemUsedDates                       = (

Re: File by how many times a file has been accessed?

PostPosted: Tue Oct 31, 2023 9:49 am
by Mr_Noodle
I think the entry spans multiple lines so you probably want grep to output lines after that.