Delete items placed in trash x days ago

Discussion in 'OS X Mountain Lion (10.8)' started by budsimrin, Aug 9, 2013.

  1. macrumors newbie

    Sep 18, 2008
    Does anyone know a way to delete items placed in the trash, say, 1 week ago or longer? I don't just wish to empty all items in trash; I wish items to stay in the trash for a few days in case I change my mind.

    I used to use Compost to do this, but it no longer is supported.

    I notice that the Mountain Lion Finder has a category "Date Added". Presumably that is the date a file was added to a folder? Can anyone write a simple script that deletes all items in the Trash folder whose date-added exceed N days, where N is any desired number? I would then schedule the script to run every day.
  2. macrumors 603

    Feb 20, 2009
    When you empty the trash, it deletes EVERYTHING within. There is no way around this, as far as I know.

    So... if you don't want to lose things put into the trash when you empty the trash -- DON'T put those things in there.

    Create a new folder on the desktop. Give it a name something like "almost trash".
    Then, put the stuff you want to _eventually_ trash (but not immediately) into this folder, instead of into the trash itself.
    Then, periodically move the folder to the trash to get rid of it.
  3. macrumors regular

    Jun 21, 2010
    It's funny, but I had the impression that modern tech was aimed at reducing the number of redundant actions required in a task, though it seems you have a better concept to share with us?
  4. budsimrin, Aug 11, 2013
    Last edited: Aug 11, 2013

    thread starter macrumors newbie

    Sep 18, 2008
    A step in the right direction...

    Thank you, Fishrrman. I appreciate your help. Your idea doesn't do quite what I need. I want to only delete items that have been in the trash for, say, 7 days (or longer). If I empty the temporary trash folder you suggest each week, I will also be deleting items that are only 1 day old, 2 days old, etc.

    It seems to me a pretty simple Applescript could be written, using the "Date-Added" folder attribute, that would check each item in the trash, one-by-one, and remove only those added 7 days ago or longer. Then the script could be schedule to run every day.

    I just am not sufficiently proficient with Applescript to do this. Perhaps a Keyboard Maestro macro would work? Or Automator?

    I know this can be done since the Compost app does this, just not in Mountain Lion. I believe Compost works in all previous versions of Mac OS X.
  5. macrumors regular


    Aug 16, 2010
    Right click on the desktop folder & go to Show View options - in the small window that opens - set 'Arrange by' to 'Date Added'.

    It will then divide the folder and you can easily see which files are over 7 days old.
  6. thread starter macrumors newbie

    Sep 18, 2008
    But... I don't want a manual process. I want it automated

    :eek:Thank you, ricede. You are correct, but then I have to remember to do this manually every day.

    I am looking for an automated process. I shouldn't have to think about emptying the trash. I want files put in the trash to disappear automatically after they have been there 7 days, and I want the other files to remain in the trash. Surely someone knows hows to write a simple script that does what you suggest?

Share This Page