Sort trash files by date trashed

One of the nice features of the recycle bin in Windows is the ability to sort it by the date an item was deleted. This way if you accidentally delete something, you can easily find it because it will be at the top of the list.

Is there any way to do something similar in Mac OS X's Trash folder?

I see that there is a date modified field, but that is not updated when the file is deleted.


Solution 1:

Update for OSX 10.9 Mavericks:

It appears that you can now sort by Date Added in OSX Mavericks. In Trash right click one of the columns and click to check the Date Added column. The click on the column header until the list of files is sorted by Date Added descending.


For OS X 10.7 Lion:

Go to the AppleScript Editor, paste in the following script and save it in /Library/Scripts/Folder Action Scripts:

on adding folder items to this_folder after receiving added_items
    repeat with this_item in added_items
        do shell script "find " & quoted form of POSIX path of this_item & " -exec touch {} \\;"
    end repeat
end adding folder items to

Then…

  1. Right-click on any folder in Finder, go to Services and click Folder Actions Setup.

  2. Cancel the dialog asking which script to attach.

  3. Click the checkbox to Enable Folder Actions

  4. Click the plus sign to choose the Trash.

    Press ⌘ cmd + ⇧ shift + G and type in ~/.Trash, click Go or press ↩ return, and then click Open.

  5. On the right side, click the plus sign to choose the AppleScript that you saved earlier.

Thanks to Graham for the link which pointed me in the right direction.

Solution 2:

This hint from Mac OS X Hints describes how to create a simple Automator Folder Action that performs touch on every file that's trashed.

Solution 3:

I don't think there is anything exactly like that in Mac OS X.

However, if you accidentally deleted something in the Finder, you can use the "Undo" command to move the file back.