Matching Based on Date Tagged (via Smart Folders)?

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

Moderator: Mr_Noodle

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
iampariah
 
Posts: 37
Joined: Thu May 12, 2016 1:21 pm

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.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

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?
iampariah
 
Posts: 37
Joined: Thu May 12, 2016 1:21 pm

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
iampariah
 
Posts: 37
Joined: Thu May 12, 2016 1:21 pm

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.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks for the tip!
iampariah
 
Posts: 37
Joined: Thu May 12, 2016 1:21 pm


Return to Support