Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

typecase

macrumors 6502
Original poster
Feb 2, 2005
390
397
Hello,

Something has been bugging me for a while now. I haven't found a way to delete a file without using the trash can. I can do it with the command line, but this is cumbersome sometimes. In Windows, I could select a file and hold down control while I hit delete and it would bypass the recycle bin and be deleted. Is there a way do this with Mac OS X?

I find this problem most annoying especially when dealing with removable drives (like USB drives) as the files are left on the drive. The only way to remove them is to use the command line or empty my entire trash can. Sometimes I'm not ready to empty the trash quite yet. Speaking of which, in windows, you could go into the recycle bin and "empty" or delete specific selected files. It seems in Mac OS X, you can only empty the entire trash can to permanently delete a file without using the command line.

Am I missing something? Please help. Is there a way to delete by bypassing the trash can? :confused:
 

pianoman

macrumors 68000
May 31, 2006
1,963
0
i don't know of any way to bypass the trash can, but you can hit shift+cmd+delete to empty the trash can using your keyboard instead of using your mouse to left click and select "Empty Trash."
 

danny_w

macrumors 601
Mar 8, 2005
4,467
300
Cumming, GA
Here Here! When is Apple going to provide something as simple as the Ctl-Delete in Windows to bypass the Trashcan? This is probably the most missed feature from Windows for me, and it is very annoying.
 

rdowns

macrumors Penryn
Jul 11, 2003
27,397
12,521
Command-Delete (backspace key) will put a file in the trash without dragging it.
 

danny_w

macrumors 601
Mar 8, 2005
4,467
300
Cumming, GA
Command-Delete (backspace key) will put a file in the trash without dragging it.
Thanks, I'll try that. I thought sure that I already had tried it, but perhaps not.

EDIT: OK, that works fine. Thanks again! I had been trying to use the 'delete' key that is above the cursor keys/to the right of the keyboard (the one with an 'x' on it); it didn't do anything.
 

typecase

macrumors 6502
Original poster
Feb 2, 2005
390
397
As I mentioned in my post, I often use rm to bypass the trash completely if there's a file on a removable disk I want to delete permanently (and recover the space on said disk) but am not quite ready to empty the rest of the trash. I'm guessing there's no direct way do this without using rm and the terminal. I suppose something could be rigged by writing a script but the OS should have this basic functionality. It's a shame, too. It'd be nice to be able to hold down the command key and hit the delete button and the file would just disappear (without moving to the trash at all--if this was not clear before I apologize). Also, it'd be great to be able to do this inside the trash as well to permanently delete specific files without emptying the rest of my trash.
 

danny_w

macrumors 601
Mar 8, 2005
4,467
300
Cumming, GA
Also, is there any way to rummage through the trash and delete just certain files or restore certain files to their original place? Both these actions are built into Windows, and are very easy. Surely there is an equivalent on Mac.
 

numlock

macrumors 68000
Mar 13, 2006
1,590
88
There is a automator plugin that deletes the files/folders completely. I have it as a plugin in the contextual menu. Theres also compost which you gives you the same basic function. But you can get burned using these utilities its happened to be with both of these softwares. Atleast the automator plugin gives you the popup menu to select yes or no.

To go through the trash and delete some and restore some i think you would need a third party application. Maybe pathfinder can do it now but filerun (which to me looked very promising) was supposed to do this among other things but its almost a year since was supposed to ready so who knows
 

ddekker

macrumors regular
Sep 23, 2006
222
0
Michigan
we had a designer that uses a mac "lose" a folder full of files I was wondering if there was a way that he could have deleted them without them making it to the trash can by hitting some strange key combination, everyone is pretty sure someone cam in through the network and nuked it..lol... paranoia.. he was copying files from his laptop to another users PC through the network...

DD
 

Macguy97

macrumors newbie
Sep 11, 2010
8
0
Brisbane
Can someone generate an AppleScipt for this?

An AppleScript would be great for this.

You could then save it in the services menu. That way, right-clicking would perform the AppleScript an delete the file?

How would you get the AppleScript to point to the file though? :confused:
 

Jolly Jimmy

macrumors 65816
Dec 13, 2007
1,357
3
An AppleScript would be great for this.

You could then save it in the services menu. That way, right-clicking would perform the AppleScript an delete the file?

How would you get the AppleScript to point to the file though? :confused:

Try this one I wrote.

Code:
tell application "Finder"
	set theSelection to selection
	
	if theSelection is {} then
		beep
		activate current application
		display alert "No files are selected for deletion." message "Select one or more files to delete." as warning
	else
		activate current application
		display alert "Delete item(s)?" message "The selected item(s) will be deleted immediately. Are you sure you want to continue?" buttons {"OK", "Cancel"} as warning
		set buttonpressed to button returned of result
		
		if the buttonpressed is "OK" then
			repeat with i from 1 to (count theSelection)
				
				set item1 to (the quoted form of POSIX path of (item i of the theSelection as alias))
				set deleteit to "rm -rf " & item1 & ""
				
				try
					do shell script deleteit
				on error
					do shell script deleteit with administrator privileges
				end try
			end repeat
		end if
	end if
end tell
 

burak.duvan

macrumors newbie
May 5, 2010
2
0
When you eject removable drives, they are removed from trash. If you do not unmount (cmd+e) the drives before you unplug them, it won't delete the files.

But I have a problem opposite to yours. I cannot send the files to trash. When I remove (cmd+backspace) the files, Finder permanently deletes them. I do not know what I did, but I don't want to delete all my files permanently, and I do not want to erase my disk and install a fresh OS X. Is there anybody who experiences the same problem?

Hello,

Something has been bugging me for a while now. I haven't found a way to delete a file without using the trash can. I can do it with the command line, but this is cumbersome sometimes. In Windows, I could select a file and hold down control while I hit delete and it would bypass the recycle bin and be deleted. Is there a way do this with Mac OS X?

I find this problem most annoying especially when dealing with removable drives (like USB drives) as the files are left on the drive. The only way to remove them is to use the command line or empty my entire trash can. Sometimes I'm not ready to empty the trash quite yet. Speaking of which, in windows, you could go into the recycle bin and "empty" or delete specific selected files. It seems in Mac OS X, you can only empty the entire trash can to permanently delete a file without using the command line.

Am I missing something? Please help. Is there a way to delete by bypassing the trash can? :confused:
 

Mr. Retrofire

macrumors 603
Mar 2, 2010
5,064
518
www.emiliana.cl/en
When you eject removable drives, they are removed from trash. If you do not unmount (cmd+e) the drives before you unplug them, it won't delete the files.
This does not delete the files. The files are still in the trash folder on the ejected volume. Btw, if you do not unmount the volume(s) before you unplug the drive(s) you can damage the file system structures on the volume(s), which can lead to data loss.

But I have a problem opposite to yours. I cannot send the files to trash. When I remove (cmd+backspace) the files, Finder permanently deletes them. I do not know what I did, but I don't want to delete all my files permanently, and I do not want to erase my disk and install a fresh OS X. Is there anybody who experiences the same problem?
https://forums.macrumors.com/showthread.php?p=13005577#post13005577
 

mmccarn

macrumors newbie
Mar 22, 2015
1
0
For total noobs like me - Here are step by step instructions to create a"Delete Permently" option in Finder:

  1. use spotlight to find and run "Automator" (OS X 10.4+)
  2. Select 'Service'
  3. Under 'Service receives selected', choose "files or folders".
  4. Under 'in' select "Finder.app"
  5. Make sure the 'Actions' is selected at the top left and search for "applescript" in the 'Name' search box
  6. Drag 'Run Applescript' into the editor window
  7. Replace the line that says '(* Your script goes here *)' with the code supplied by Jolly Jimmy
  8. Click 'File', 'Save' and name your menu item "Delete Permanently" (or another name of your choice)
  9. Close Automator

You now have a 'Delete Permanently' (or whatever) item on the right-click menu for any file on your system, including individual files in the trashcan.

Try this one I wrote.

Code:
tell application "Finder"
	set theSelection to selection
	
	if theSelection is {} then
		beep
		activate current application
		display alert "No files are selected for deletion." message "Select one or more files to delete." as warning
	else
		activate current application
		display alert "Delete item(s)?" message "The selected item(s) will be deleted immediately. Are you sure you want to continue?" buttons {"OK", "Cancel"} as warning
		set buttonpressed to button returned of result
		
		if the buttonpressed is "OK" then
			repeat with i from 1 to (count theSelection)
				
				set item1 to (the quoted form of POSIX path of (item i of the theSelection as alias))
				set deleteit to "rm -rf " & item1 & ""
				
				try
					do shell script deleteit
				on error
					do shell script deleteit with administrator privileges
				end try
			end repeat
		end if
	end if
end tell
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.