Can I set Trash to completely delete certain old files automatically?

hanhk

macrumors newbie
Original poster
Jul 26, 2010
3
0
I want it to either

  1. Conserve disk space and confine the size of Trash to a certain percentage of the total hard disk space and automatically delete old files to meet that limit; or
  2. Automatically delete files that has been sent to trash for a certain period of time.

Can I do that in Mac OS X? Thanks!
 

MisterMe

macrumors G4
Jul 17, 2002
10,650
28
USA
Emptying the Trash is a one-click operation. You are trying to dramatically complicate this simple task. Why?
 

phatqao

macrumors member
Jul 20, 2010
50
0
PA and/or NYC
i can see this being done with a script that deletes all files of a certain 'age', scheduled to run every night (or whatever) with cron. the script could run something like
Code:
#!/bin/bash

cd /Users/[your-name]/.Trash
rm -v `find . -mtime -2` >> /Users/[your-name]/logfile.txt

exit 0
then have this script run by cron every night - it will delete all files from the trash that were created the previous day.

not positive that this would be so easy (there could be something i'm overlooking), but here are some resources to help you out

http://adminschoice.com/crontab-quick-reference
 

hanhk

macrumors newbie
Original poster
Jul 26, 2010
3
0
Emptying the Trash is a one-click operation. You are trying to dramatically complicate this simple task. Why?
Because I am not sure if I will want to recover something I've just deleted some day, but probably some day not in the far future. So it is only safe to delete files that has been moved to trash for, say, two weeks or more.
 

brijazz

macrumors 6502
Jul 31, 2008
292
7
I would recommend software called "Hazel". It's sort of like super-powered Folder Actions, but has a built-in Trash management component that does exactly what you're asking about. It's developed by Noodlesoft.

 

hanhk

macrumors newbie
Original poster
Jul 26, 2010
3
0
I would recommend software called "Hazel". It's sort of like super-powered Folder Actions, but has a built-in Trash management component that does exactly what you're asking about. It's developed by Noodlesoft.

Great software but it needs to be paid. If only there's a freeware for that... Thank you for the suggestion though!