
Show HN: Set OS X files and folders to self-destruct based on tag - turtleofdeath
http://scottmw.com/463/os-x-set-file-self-destruct-based-tag/
======
derefr
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.

------
drhayes9
For easy-to-use OSX automation I'm a big fan of Hazel:
[http://www.noodlesoft.com/hazel.php](http://www.noodlesoft.com/hazel.php)

I bet you could set up something similar in it.

------
kolev
This is a pretty good idea. Add the ability to tag a file/files with TTL from
the CLI as well.

Source code: [https://github.com/tdlm/os-x-self-
destruct](https://github.com/tdlm/os-x-self-destruct)

~~~
scott_karana
> Add the ability to tag a file/files with TTL from the CLI as well.

You can use the OS's standard facilities to do what you want: see `xattr` and
`mdfind`.[1] There's also `tag`[2]

    
    
      1 http://apple.stackexchange.com/questions/93979/are-the-osx-mavericks-tags-visible-from-the-command-line
      2 https://github.com/jdberry/tag

~~~
kolev
I'm using tag, too, but it's in C, so, I suggested xattr to the author. I
submitted an issue already (first!): [https://github.com/tdlm/os-x-self-
destruct/issues/1](https://github.com/tdlm/os-x-self-destruct/issues/1)

------
alexisnorman
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.

------
bithush
It mentions it uses srm, is that any use with an SSD with wear levelling etc?

~~~
scott_karana
Probably not. Hopefully you're also using FileVault, though it doesn't totally
alleviate recovery risks (from undelete scripts, etc)

------
jason_slack
Interesting idea, can anyone give me ideas for specific use cases in everyday
use?

~~~
johndavi
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)

~~~
hk__2
Why not using /tmp?

~~~
scott_karana
1 Workflow: you can put the files _anywhere_ this way, and still have them get
deleted.

2 Time granularity (though you could, I suppose, set up subdirectories in
/tmp/ with associated hourly/daily/weekly/monthly cronjobs)

------
Lai0chee
Is there no at(1) on OSX?

~~~
alayne
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.

