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

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

  1. hanhk macrumors newbie

    Joined:
    Jul 26, 2010
    #1
    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

    MisterMe

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

    phatqao

    Joined:
    Jul 20, 2010
    Location:
    PA and/or NYC
    #3
    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
     
  4. hanhk thread starter macrumors newbie

    Joined:
    Jul 26, 2010
    #4
    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

    brijazz

    Joined:
    Jul 31, 2008
    #5
    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.

    [​IMG]
     
  6. hanhk thread starter macrumors newbie

    Joined:
    Jul 26, 2010
    #6
    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