Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A cron approach' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A cron approach
Authored by: maxgraphic on Aug 06, '03 01:13:02PM

This approach empties your trash on the hour of files that haven't been accessed in 90+ minutes.

$ crontab -e
[this launches vi or your default editor]
Add the line:
0 * * * * find ~/.Trash -amin +90 -exec rm -fr {} \;

---
Design your own business cards and more
http://www.designyourowncard.com/



[ Reply to This | # ]
A cron approach
Authored by: Mikey-San on Aug 06, '03 11:25:44PM

Ew ew ew ew!

The beauty of the empty trash script is that if a file is in use, the OS won't allow it to be deleted. You'll get a warning dialog instead.

With rm, you might kill files something is still using. That could suck.



[ Reply to This | # ]
A cron approach
Authored by: maxgraphic on Aug 07, '03 01:53:09PM

Then again, the beauty of rm is that it'll empty the trash of stubborn items that the Finder might claim are in use that aren't.

---
Design your own business cards and more
http://www.designyourowncard.com/



[ Reply to This | # ]
A cron approach
Authored by: chally on Sep 14, '06 02:29:30AM
I've found that without the following in the find command, the trash directory itself is killed, causing an "auto-empty" when an item is dragged to the trash (at least the finder figures it out and warns you though.)

    -not \( -name .Trash \)

So the whole crontab entry would be

    find ~/.Trash -not \( -name .Trash \) -exec rm -fr {} \;

Still, this solution is somewhat useless to me because it does not handle my Power Mac G5's second drive or temporarily mounted drives. I looked into handling that and though I think I basically groked what's going on I determined:

  1. I'm not sure enough what I'm doing
  2. Deleting things automatically is scary
  3. To do the job properly, if I knew what I was doing would require a fairly complex script.
Use at your own risk.

[ Reply to This | # ]