Page 1 of 1

How to code rules to do the Trash logic on another folder?

PostPosted: Mon Jun 10, 2019 9:04 am
by halloleo
Hi there

I'm using MailMate and it saves the attachments from mail messages in a fix location ~/Library/Application Support/MailMate/Attachments/. I want to clean out the files and folders in this location regularly with a logic similar to what Hazel already does for the Trash: Delete files sitting in the Trash for 6 months.

How can I code rules for this?

Many thanks,
Leo

Re: How to code rules to do the Trash logic on another folde

PostPosted: Mon Jun 10, 2019 10:03 am
by Mr_Noodle
In general, it's a bad idea to have Hazel process the internal files of another application. I would contact the developer of MailMate to make sure it won't affect operation.

If it's ok, then something like "Date added is not in the last 6 months, Move to trash" would probably work.

Re: How to code rules to do the Trash logic on another folde

PostPosted: Tue Jun 11, 2019 3:55 am
by halloleo
Thx for your prompt repsonse!

Yes, the folder is a place were MailMate caches attachments for quicklook. So apart from Date added, the date last opeend is important too.

How do the dates "Date added" and "Date Last opened" related to the normal file stats "Date created", "Date last accessed" and "Date last modified"?

Re: How to code rules to do the Trash logic on another folde

PostPosted: Tue Jun 11, 2019 10:23 am
by Mr_Noodle
Date added is when the file was added to that folder. Date opened is when it was last opened.

Re: How to code rules to do the Trash logic on another folde

PostPosted: Tue Jun 11, 2019 7:23 pm
by halloleo
Thanks Paul.

BTW, I had a look around for clarification between "Last opened" Metadata and "Last accessed" file stats, I and found a great blog post for this: MacOS Timestamps from Extended Attributes and Spotlight | Forensic 4cast

Bottom line: "Last accessed" is trigger even by system events like indexing, "Last opened" is (hopefully) only set when the user opens the file.