Emptying trash for only certain files?

1. Is there a way to empty only certain files from the trash without emptying all of the files?

2. When a USB jump drive is plugged in, is there a way to empty the trash for just those files and not for the Mac?

Thanks.

Macpro, Mac OS X (10.5.1)

Posted on Mar 22, 2011 10:25 AM

Reply
40 replies

Aug 28, 2013 8:28 PM in response to salper7

So it is now working. Thank you very much. I figured that it was only a matter of the order of the "yes," "no" buttons. One more thing, how would I do this in applescript? I only ask because I would like to set a default button (I would like it to automatically highlight "no") and maybe, if it's not too much trouble" change the default image that it shows from the basic one with the blank paper and pencils.



Thanks so much!!!

Sep 16, 2013 7:30 AM in response to Mark P1

This is a very good question. Let me try to answer your question.


1. Open "Terminal", then type

cd .Trash/

2. Then type

find . -mtime +5 -exec rm -rf {} \;

if you want to remove all the files in the Trash that are deleted more than 5 days ago. You can change the number "5" to number you like.


Typically that's mostly what I need.


Hope this helps.


Eddie

Feb 17, 2015 5:32 AM in response to Mark P1

The PERFECT SOLUTION....



Thanks to Jacques Rioux and iorganutan

I know this is an old thread -



I use this script AppleScript, save it as Application :


on open these_volumes

set t_id to user ID of (system info)

repeat with i in these_volumes

if (kind of (info for i without size)) is "Volume" then

set tPath to (POSIX path of i) & ".Trashes/" & t_id

do shell script "/bin/rm -Rf " & (quoted form of tPath) & "/*"

end if

endrepeat

end open

----------------------------------------------

Drag/Drop Volume(s) on the application.


This script removes the items from your trash (user ID) folder on the volume.

if other users use the volume this script will not delete the items from their trash folder, otherwise the script would need an administrator password to do that.



----------------------------------------------

If you want to eject the volume after emptying the trash, use this script.


on open these_volumes

sett_idto user ID of (system info)

set volToEject to {}

repeatwith i in these_volumes

if (kindof (info foriwithoutsize)) is "Volume" then

set tPath to (POSIX path of i) & ".Trashes/" & t_id

do shell script "/bin/rm -Rf " & (quoted form of tPath) & "/*"

set end of volToEject to contents of i

end if

endrepeat

ifvolToEjectisnot {} thentellapplication "Finder" toejectvolToEject

end open



Discussion over.

Mar 7, 2015 7:07 AM in response to Mark P1

For those who are not comfortable using the command line, there is rather an ingenious way....

First create a folder named "deleter" on desktop and in documents ( you can choose any 2 locations )

Again create an automator service accepting files and folders as input.

  • optionally add "ask for confirmation"
  • "Move finder Items" to the 'deleter' folder (which was on the desktop/location1)
  • add 'get specified finder items" (ignore input on this action by right-clicking and selecting 'ignore input') and add the 'deleter' folder which was created in documents folder/location2.
  • add "move finder items" to 'desktop/location1' and tick 'replace existing files'
  • Now add run shell script and again ignore input. type :

cd ~/Documents (or add the path to location2)mkdir deleter

save it

The run shell script action was added so that this service can be used again and again... otherwise we would have had to create the the deleter folder in documents every time before using the service.


try it out...!

Sep 14, 2015 12:51 PM in response to Mark P1

I've read this thread from beginning to end and the only thing I have gained in an insight into the absurdity of human nature.


The problem is a real one, a serious one, and has yet to be taken seriously by Apple.


The most ridiculous responses I read were those that told the original poster that the trashcan was only for items you knew you wanted to get rid of.

Uh, duh, if that were true, then why would they be STORED in the trashcan instead of dumped immediately?


We have a dual OS in our house: Windows and Apple. And when it comes to user-sensibility, MS wins hands down. I delete items when I don't want the clutter. But included in those items are some of dubious nature. I'm not a hundred percent sure, but I don't want to waste time making a decision now. I don't want to search out a transition location for "not-sure-now" because that is exactly what the trash is for; otherwise it would not be keeping items. When I am finally certain about particular items, I delete them. If I've changed my mind I restore them. Simple.


Please note: Apple offers users the option to restore single or grouped items, so obviously even the engineers recognize that some items might require reconsideration. Why not also offer the reverse strategy?


Well, from "telling" its clients that you will not have access to a two button mouse or a forward delete or any other item of convenience, Apple has made clear that we customers have nothing of value to tell them.


I would truly be interested in hearing from a single ordinary customer that managed to convince Apple to change a single thing. Ever.


And, by the way, anyone know of a simple way of finding and clearing the artifacts of old apps we have removed from or updated in the system? My own guesstimate is that over 25% of fixed drive substance on our house Mac is totally superfluous (unnecessary copies of unnecessary copies of unnecessary copies of ... photos and videos that have been mishandled by novice users, and even some competent ones). But how to find these ...?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Emptying trash for only certain files?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.