Page 1 of 1

Matching Based on Date Tagged (via Smart Folders)?

PostPosted: Thu May 12, 2016 1:34 pm
by iampariah
I could use some help on the following workflow.

I have created three file tags--Delete1Day, Delete2Weeks, and Delete30Days--to help clean up files I no longer need. Files tagged Delete1Day, for instance, will be moved to the trash tomorrow. Files so tagged remain where they are in the file system; I don't move them to a new location so that I can continue to find them in-context and in case I later decide not to delete them (and remove the tag).

I've built Smart Folders/search folders to find all such tagged files (and folders). My hope when upgrading to Hazel 4 yesterday was to use Hazel to watch those Smart Folders and delete all of the Delete-something tagged files based on time. For instance, Hazel will monitor the Delete2Weeks Smart Folder and delete all files that were tagged 14 days ago. There's the stumbling point.

Applying a tag in Yosemite doesn't alter the file's modification date or any other attribute I can think to use for Hazel matching. Hazel matches on file's created, modified, or added dates regardless of the date on which I applied the tag to delete it at a future date. I want to be able to have Hazel look at files in the Smart Folder and determine the date to delete based on the date I SAID delete in X number of days... somehow.

Any ideas on how I can make this work?

Thanks.

--Pariah

Re: Matching Based on Date Tagged (via Smart Folders)?

PostPosted: Thu May 12, 2016 1:55 pm
by Mr_Noodle
Hazel can't really control that. You can try looking at other date attributes to see if any of the other ones work. Otherwise, you'll have to come up with a more involved system. Maybe when the tag first appears, you can put the current date into the comment, which you can then match later, or something along those lines.

Re: Matching Based on Date Tagged (via Smart Folders)?

PostPosted: Thu May 12, 2016 2:36 pm
by iampariah
Interesting idea. Can I have Hazel check the comment to see if there's a date in it? If not, add the date. Once there is a date, evaluate whether it's time to trash the file based on that date? Is that possible?

Re: Matching Based on Date Tagged (via Smart Folders)?

PostPosted: Thu May 12, 2016 6:51 pm
by iampariah
Ok. I figured it out. It's not an elegant solution by any means, but it does the job and requires only that I tag the files, which is what I wanted.

  1. Tag the files as described above (Delete1Day, Delete2Weeks, Delete30Days)
  2. Hazel: If Date Last Matched is blank, run Automator Workflow
    Image
  3. Hazel: If Date Last Modified is not in the last x days, move to Trash
    Image

Re: Matching Based on Date Tagged (via Smart Folders)?

PostPosted: Fri May 13, 2016 9:38 am
by Mr_Noodle
Don't use "Get Selected Finder Items" in your Automator workflow. That will just grab whatever Finder happens to have selected at the time. Hazel will pass in the file so just leave the beginning of the workflow open-ended where it can accept a file.

Re: Matching Based on Date Tagged (via Smart Folders)?

PostPosted: Mon May 16, 2016 12:36 pm
by iampariah
Thanks for the tip!