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

Discussion in 'macOS' started by hanhk, Jul 26, 2010.

  1. hanhk macrumors newbie

    Jul 26, 2010
    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!
  2. MisterMe macrumors G4


    Jul 17, 2002
    Emptying the Trash is a one-click operation. You are trying to dramatically complicate this simple task. Why?
  3. phatqao macrumors member


    Jul 20, 2010
    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
    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
  4. hanhk thread starter macrumors newbie

    Jul 26, 2010
    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.
  5. brijazz macrumors 6502


    Jul 31, 2008
    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.

  6. hanhk thread starter macrumors newbie

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

Share This Page