I use Hazel (mentioned by drhayes9 too) to monitor various folders and take action regularly. On the delete side, this includes:
* clearing out any items in Downloads > 1week
* clearing out any items from my "Temp" folder > 1 day, unless they have an explicit "save" tag ("Temp" is my go-to alternative to the Desktop and is where I stash anything, well, temporary-ish)
* automatically moving screenshots into my Temp folder (where they will soon be deleted)
If this was based on atime instead of mtime, and was coupled with Time Machine backups, it'd actually make an interesting form of Hierarchical Storage Management. Files would "expire" from your local disk, but still be restorable.
On a tangent, that's really what I (and I think most people) want from HSM—not "files canonically being on slow media but being cached on faster media", but rather "files canonically being on small/fast media, and then migrating to slower media when you stop caring about them, as if a garbage-collection pass had occurred, leaving your disk with more space." Basically, HSM should do automatically what people do manually when they e.g. burn files to optical disks to clear up space.
This is awesome. I've been waiting for Yosemite's JS Automation so I can do some similar things with my downloads (Moving into folders based on tags, etc.) so this is going to be fun to play around with.
Yes, you could queue an at job for every deletion. If you moved the file that approach would break. Also, you'd have to remove that at queue entry if you changed your mind.
16 comments
[ 3.4 ms ] story [ 40.5 ms ] threadSource code: https://github.com/tdlm/os-x-self-destruct
You can use the OS's standard facilities to do what you want: see `xattr` and `mdfind`.[1] There's also `tag`[2]
* clearing out any items in Downloads > 1week * clearing out any items from my "Temp" folder > 1 day, unless they have an explicit "save" tag ("Temp" is my go-to alternative to the Desktop and is where I stash anything, well, temporary-ish) * automatically moving screenshots into my Temp folder (where they will soon be deleted)
https://github.com/benjaminoakes/maid
2 Time granularity (though you could, I suppose, set up subdirectories in /tmp/ with associated hourly/daily/weekly/monthly cronjobs)
I bet you could set up something similar in it.
On a tangent, that's really what I (and I think most people) want from HSM—not "files canonically being on slow media but being cached on faster media", but rather "files canonically being on small/fast media, and then migrating to slower media when you stop caring about them, as if a garbage-collection pass had occurred, leaving your disk with more space." Basically, HSM should do automatically what people do manually when they e.g. burn files to optical disks to clear up space.