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

Delete files without emptying the Trash System 10.8

Long ago, we detailed a (rather scary) way to delete files without needing a stop in the trash can. A recent thread on StackExchange brought the issue up again, and some folks there provided other, less scary approaches.

Why would you want to delete a file without needing to choose Empty Trash? Hereís one example: You have some files in the Trash on your Mac that youíre not ready to pull the trigger on forever. Now you connect a USB drive and have files on it that you wish to dispose of. If you drag those files to the Trash, you have to select Empty Trash to do itówhich means deleting the files from both the drive and your Mac itself.

Most Hints readers know about the rm Terminal command, which lets you remove files instantly and without a trip to the Trash. But thatís always the most convenient approach. One tip at StackExchange suggests wrapping that Terminal command in an Automator action, which you could then store in the Dock or add as an OS X Service for easy access from the Services menu. You can see the Automator action at StackExchange.

There are also third-party apps like Trash X and Trash Without that help you accomplish the same goal.

    •    
  • Currently 2.33 / 5
  You rated: 2 / 5 (9 votes cast)
 
[30,216 views]  

Delete files without emptying the Trash | 9 comments | Create New Account
Click here to return to the 'Delete files without emptying the Trash' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Forgotten "not"
Authored by: SeanAhern on Jul 17, '13 08:20:24AM

Looks like a "not" was forgotten in this sentence: "But thatís always the most convenient approach.".



[ Reply to This | # ]
Delete files without emptying the Trash
Authored by: flmiller on Jul 17, '13 11:35:51AM

Um... if you're not sure about discarding a file, don't put it in the trash! Not really rocket science. I've long used a folder on the desktop, labelled 'ToBeTrashed', for this purpose. If I really don't need the file after some time has passed, off to the trash it goes.



[ Reply to This | # ]
Delete files without emptying the Trash
Authored by: jdb8167 on Jul 17, '13 02:22:28PM
I did this a while back. I created an automator script which I placed in the services menu which also puts it under the right click menu in the Finder. To create it:


Create an automator script:


Set the "Services receives selected" to "files or folders" in "Finder"


Go to the Library tab and choose Utilities->Run AppleScript


The AppleScript:

on run {input, parameters}
	repeat with anItem in input
		tell application "Finder"
			set itemAlias to anItem as alias
			set i to (info for itemAlias)
			set {kind:itemKind, package folder:packageFolder, name:itemName} to i
			if itemKind = "Folder" then
				set fileList to items of itemAlias
				if (count of fileList) is greater than 0 then
					display dialog "Are you sure you want to delete the folder \"" & itemName & "\" and all of its contents?"
				end if
			else if packageFolder then
				display dialog "Are you sure you want to delete the package folder \"" & itemName & "\""
			end if
		end tell
	end repeat
	
	return input
end run


Add an "Ask for Confirmation" script:


Title: Delete Item(s) Now?
Subtext: This operation can't be undone

Add a Run Shell Script. Make sure the Shell is set to "/bin/bash"


The bash script:

for file in "$@"
do
  if [ -f "$file" ]
     then
      rm "$file"
    else
      rm -rf "$file"
  fi
done


This altogether will check to see if an application or non-empty folder is selected and warn before deleting them. It also gives a final chance to stop the delete. If the files selected are not packages (usually applications) or folders, then it only gives the single warning.

Edited on Jul 17, '13 02:24:25PM by jdb8167


[ Reply to This | # ]
Delete files without emptying the Trash
Authored by: Lapo on Jul 17, '13 04:18:10PM

My "quick and dirty" method, for people who are afraid of Terminal commands: I put the files in a new folder, and I create elsewhere a second folder with the exact same name as the first one. Then I drag this second folder to the same place as the first one. I answer "replace" to the alert dialog, and "voilŗ": the empty folder send the full one to the Void...



[ Reply to This | # ]
Delete files without emptying the Trash
Authored by: bschappel on Jul 18, '13 07:31:17AM

I use Path Finder and one of its long-standing features is its ability to selectively empty the Trash on a volume by volume basis. A simple right-click on the PF Trash can brings up a menu that allows you to empty or secure empty the Trash. Couldn't be easier.



[ Reply to This | # ]
Delete files without emptying the Trash
Authored by: fferitt25 on Jul 18, '13 12:50:17PM

Why would you store files inside of the Trash anyway ?

I have had clients through the years for whatever reason actually store files in the Trash (as if it were any other Folder. I have never understood this behavior.

I even asked a few of them if they would store potenially important phyical documents in their actual trach can next to their desk - they usually say No. Bu they still neve got the connection to the anaolgy.

I never have figured out that mentality.

I don't use an extra folder - I have the confirmation dialog turned OFF - typically I have redundant copies of something important and if it goes into the trash folder - it's gone.

People already have the extra step built in where they actually have to run the delete command - whether form the keyboard or the menus or the terminal or automator or some 3rd party software. Prior to that you can always open the trash folder up and look into it.

Aside from the script - I wonder if there would be a way to turn the Trash Folder itself into a watch folder - to force a delete function as soon as you send the command ? No need for it having an extra step.



[ Reply to This | # ]
Deleting the Trash of a particular volume only
Authored by: tempel on Jul 18, '13 02:00:50PM

I sometimes want to delete the trash of an external drive only. I still favor the good old DragThing for that, which also offers a separate trash can that doesn't sit in the Dock but can be placed in the corner of the screen - makes dragging items to the trash easier, too, because I don't have to hit that Dock can but can them simply drag to the corner.
When right-clicking (or ctrl-clicking) onto that trash, it lets me choose to delete a particular volume's trash only.



[ Reply to This | # ]
Delete files without emptying the Trash
Authored by: negritude on Jul 20, '13 03:34:03PM

Delete Without Trash is a free tool that works via contextual menus:

http://www.blazingtools.com/delete_without_trash_mac.html

Edited on Jul 20, '13 03:49:05PM by negritude



[ Reply to This | # ]
Delete files without emptying the Trash
Authored by: DavidRavenMoon on Aug 07, '13 07:59:18AM

I never put anything in the trash that isn't going to be deleted shortly after, if not right away.

If it's one of those cases where I moved preference files or something that I might want to keep for a bit, and there are other things I do want to trash, I move the items I don't want to trash yet to the desktop, or to a folder on the desktop.

Seems like less work than writing a script for it.

---
iMac 2.93 GHz Core 2 Duo, 8GB, 1TB, Mac OS X 10.8.4
www.david-schwab.com
www.myspace/davidschwab
www.sgd-lutherie.com



[ Reply to This | # ]