PDA

View Full Version : Delete items placed in trash x days ago




budsimrin
Aug 9, 2013, 01:08 PM
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.



Fishrrman
Aug 10, 2013, 09:56 AM
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.

Suggestion:
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.

Modernape
Aug 11, 2013, 02:10 PM
Suggestion:
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.

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?

budsimrin
Aug 11, 2013, 03:11 PM
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.

ricede
Aug 11, 2013, 11:46 PM
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.

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.

budsimrin
Aug 12, 2013, 10:17 PM
: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?