Skip to content

Instantly share code, notes, and snippets.

@hnnesv
Created June 23, 2015 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hnnesv/9de4bee4d1e4611964e4 to your computer and use it in GitHub Desktop.
Save hnnesv/9de4bee4d1e4611964e4 to your computer and use it in GitHub Desktop.
evaporate
#!/bin/bash
# Remove any files or folders that have a 'transient' tag and haven't been accessed in a while
echo "[`date`] Evaporate task triggered";
for i in `mdfind -onlyin ~ 'tag:transient'`; do
if test "`find $i -atime +5`"; then
rm -fR $i;
echo "[`date`] Removed $i";
fi
done
<?xml version="1.0"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>localhost.evaporate</string>
<key>Program</key>
<string>/Users/hannes/bin/evaporate</string>
<key>StartInterval</key>
<integer>20000</integer>
<key>StandardErrorPath</key>
<string>/var/log/evaporate.log</string>
<key>StandardOutPath</key>
<string>/var/log/evaporate.log</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment