Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.6: Set time of deletion for files placed in the Trash System 10.6
Snow Leopard only hintTo make it easier to retrieve accidentally-deleted items from the trash, you can use an Automator workflow and the third-party Automator action Touch Files to create a "date deleted" time stamp on files placed in the trash. Here's how:
  1. Download the Automator action and unzip it.
  2. Open Automator and import this action (File » Import Actions and navigate into the Touch Files folder to find the Action).
  3. Create a new Folder Action workflow in Automator.
  4. Click the Choose Folder pop-up at the top of the workflow, and select Other. When the file choice dialog appears, type Shift-Command-G, then type ~/.Trash/ and click Choose.
  5. Drag the Touch Files action (you can find it under Files & Folders) into your workflow. I recommend checking the Apply to contents of folders option, otherwise if you delete a folder, its files' modification date will remain unchanged.
  6. Save the Folder Action with a relevant name (Set Modification Date or whatever).
Now when you add a file to the Trash, its modification date will change. Sort the Trash window by date modified, and your most recently deleted files will be at the top.

[robg adds: This worked very well in my testing -- just make sure you give the workflow a second or two to run before checking the modification date. It worked on both files and folders with the option checked as described above. This is a nice solution to finding the most-recent of multiple similar/identical files you've deleted. One caveat: this will only work for files you delete from your boot drive; if you have other drives connected, items deleted from those drives actually go into a different folder (/Volumes/volume_name/.Trashes/501). I'm not sure if there's an elegant solution for handling any arbitrary connected drive or not...readers?]
    •    
  • Currently 2.93 / 5
  You rated: 3 / 5 (15 votes cast)
 
[11,508 views]  

10.6: Set time of deletion for files placed in the Trash | 8 comments | Create New Account
Click here to return to the '10.6: Set time of deletion for files placed in the Trash' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.6: Set time of deletion for files placed in the Trash
Authored by: HelgeG on Jan 26, '10 11:21:03AM

For this (and many other maintenance tasks), my goto-solution is Hazel from Noodlesoft. Granted, it is not free, but it is well worth the price (the license fee is $21.95) http://www.noodlesoft.com/hazel.php



[ Reply to This | # ]
10.6: Set time of deletion for files placed in the Trash
Authored by: Saaby on Jan 26, '10 11:57:06AM

How do you set this up in Hazel? Set Hazel to run the action instead of automator? I have hazel, but have no clue how I'd set this up.



[ Reply to This | # ]
10.6: Set time of deletion for files placed in the Trash
Authored by: baltwo on Jan 26, '10 01:17:12PM

Why? Learn how not to use the Trash as a temporary holding or storage area. Additionally, use Time Machine, and have a permanent way to recover erroneously deleted items.



[ Reply to This | # ]
10.6: Set time of deletion for files placed in the Trash
Authored by: Sesquipedalian on Jan 26, '10 02:12:13PM
This bit of AppleScript code, when saved as a folder action script, should accomplish the same task, only faster. Plus, it can be added to any folder without needing modification (as the Automator version does), and it does not require you to install anything extra on your system.
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


[ Reply to This | # ]
using Hazel to manage trash
Authored by: dajaka on Jan 26, '10 02:53:11PM

To do this with Hazel, open the Hazel pref pane and click on the "trash" button. This is a separate function from its folder management capabilities.
Hazel lets you manage the trash according to the amount of time an item has been in the trash, as well as the size of items in the trash. You can also automatically delete files normally or securely.



[ Reply to This | # ]
10.6: Set time of deletion for files placed in the Trash
Authored by: david-bo on Jan 31, '10 10:00:54AM

This is a stupid solution. You are modifying a file although it remains the same. Would be better to add the trash date to the comment field or something like that.



[ Reply to This | # ]
10.6: Set time of deletion for files placed in the Trash
Authored by: TonyT on Jul 20, '13 05:22:46AM

I think it's better to change

do shell script "find " & quoted form of POSIX path of this_item & " -exec touch {} \\;

to

do shell script "touch -m " & quoted form of POSIX path of this_item

Also, to configure folder actions, you can go to /Library/Scripts/Folder Actions and select Configure Folder Actions



[ Reply to This | # ]
10.6: Set time of deletion for files placed in the Trash
Authored by: TonyT on Jul 23, '13 08:49:52AM

Opps, I was wrong, ignore my previous comment. -exec touch {} \\; is needed to recurse touch when a Folder is trashed.



[ Reply to This | # ]