By accident I have several times moved some important files from the Desktop to the Trash Can, and then emptied the Trash Can before discovering that the files were missing ... sigh! I decided that I needed some sort of automatic backup mechanism for the Trash Can -- in that way I would have some time to react to such mistakes.
I wrote a very simple bash script to copy files in the trash can to a backup directory:
#!/bin/sh
# trashbackup.sh ; version 1.0
ditto ~/.Trash/ ~/.Trash_backup/
I invoke the script every 10 minutes via /etc/crontab, using this crontab entry: (I am the user bt):
# The periodic and atrun jobs have moved to launchd jobs
# See /System/Library/LaunchDaemons
#
# minute hour mday month wday who command
*/10 * * * * bt /Users/bt/app-unix-scripts/trashbackup.shMac OS X Hints
http://hints.macworld.com/article.php?story=20060831022320126