Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How do I delete files & bypass the Trash?

Is there a way to completely remove files from my system without moving them to the Trash?


AND


I've read about the Trash, but I'm not clear on EXACTLY how it works. Can I empty A file from the trash or when I click on a file & choose "Emtpy the Trash" does it empty ALL of the files in the Trash or just that one file?


Is there a way to just empty ONLY 1 file from the trash or restore ONLY 1 file from the Trash if so how?


ALSO, what are the "rules" for MOVING files rather than COPYing them? I thought files that went from one folder to another on the same drive, were moved & ones that went to different drives were copied. It seems like I've run acrorss instances where that's not how things work.

Mac Pro, Mac OS X (10.6.8)

Posted on May 5, 2012 9:16 AM

Reply
Question marked as Best reply

Posted on May 5, 2012 9:57 AM

To delete a file or folder without moving it to the Trash, open Terminal in Applications>Utilities and copy/paste


sudo rm -rf


Then, important, leave a space after the -rf and drag the file or folder into the Terminal window -- it will then appear with the path of that file or folder -- and hit return. You will be asked for your admin password -- nothing will appear as you type it in -- and given a warning about using the sudo command, if this is the first time using sudo.


Note: the rm command, especially run with sudo (sudo gives you root access) is a very dangerous command; it must be used with great care. No second chances.


You cannot selectively empty the Trash. It's all or nothing. If you want to Trash a single file or folder, then move all the other ones you don't want to empty out of the Trash.


AFAIK, dragging a file from one volume or drive to another should leave the original in place and move a copy over. I've never heard of any exceptions. However, if you are dragging a file or folder over using the Finder, I don't think the Permissions for the copy will necessarily be preserved, except for files or folders moved within your user, where your user is already the owner. Even within your user, the owner may be changed to your user, even if you are not the owner.


Outside of your user, the permissions will be changed to reflect your user as owner, which will be wrong. So it's not a great way to copy over anything from /Library or /System/Library using the Finder, where the owner should be system or root, or other, not your user. If you do this, it's probably then a good idea to repair Permissions, so they are restored properly. That said, Permissions repair will not touch anything in your user.


Moving things with the Finder isn't always the best way to do this.

27 replies
Question marked as Best reply

May 5, 2012 9:57 AM in response to bamim2

To delete a file or folder without moving it to the Trash, open Terminal in Applications>Utilities and copy/paste


sudo rm -rf


Then, important, leave a space after the -rf and drag the file or folder into the Terminal window -- it will then appear with the path of that file or folder -- and hit return. You will be asked for your admin password -- nothing will appear as you type it in -- and given a warning about using the sudo command, if this is the first time using sudo.


Note: the rm command, especially run with sudo (sudo gives you root access) is a very dangerous command; it must be used with great care. No second chances.


You cannot selectively empty the Trash. It's all or nothing. If you want to Trash a single file or folder, then move all the other ones you don't want to empty out of the Trash.


AFAIK, dragging a file from one volume or drive to another should leave the original in place and move a copy over. I've never heard of any exceptions. However, if you are dragging a file or folder over using the Finder, I don't think the Permissions for the copy will necessarily be preserved, except for files or folders moved within your user, where your user is already the owner. Even within your user, the owner may be changed to your user, even if you are not the owner.


Outside of your user, the permissions will be changed to reflect your user as owner, which will be wrong. So it's not a great way to copy over anything from /Library or /System/Library using the Finder, where the owner should be system or root, or other, not your user. If you do this, it's probably then a good idea to repair Permissions, so they are restored properly. That said, Permissions repair will not touch anything in your user.


Moving things with the Finder isn't always the best way to do this.

May 5, 2012 10:37 AM in response to bamim2

The Trash is not a repository for iffy or junk files, it is for files that you no longer want and should be emptied on a regular bases.


If you have files that are iffy, you should create a folder named (iffy, junk or save for trash) either on your Desktop or in your User Folder and keep them there until your ready to trash them.

May 5, 2012 11:10 AM in response to bamim2

The Terminal is a good way to bypass the trash, but is very slow compared to this:


1) Highlight whatever it is you want to trash as you normally would.


2) Press Command+Backspace


3) Press Command+Option+Shift+Backspace


Once I've highlighted the files and folders I want to remove, I can do the keystrokes in - literally - one second. Maybe slightly more. This bypasses any messages about "Are you sure you want to permanently erase..."


There are two things to watch out for. One, as has been mentioned, everything in the Trash will be removed when you empty it. There is no selective way to do it. Two, the keystrokes, as I said, give you no messages. The trash just plain empties. So make sure there's nothing in the trash you don't want removed, because you will get no secondary message to change your mind.

May 5, 2012 11:18 AM in response to WZZZ

OK, just tested to be sure about what I said about Permissions not being preserved when copy/moving between volumes using the Finder to /Library or /System/Library. They are not. The owner becomes, incorrectly, your user and I believe may extend recursively to all nested folders in a directory.


Must use instead:


(sudo) cp -pR


including the path from the volume to the target volume (The R flag is for folders/directories, but not needed for files. Prefix with sudo, if necessary. The -p flag preserves Permissions in the move.)


Kurt, some good keyboard acrobatics needed for that maneuver. But no problem for any virtuoso pianist who can span three octaves with one hand. 😉


Message was edited by: WZZZ

May 5, 2012 11:44 AM in response to bamim2

You can delete files immediately with Terminal:

rm -f (drag file to Terminal window, press return)


To delete folders and their contents:

rm -rf (drag folder to Terminal window, press return)


To restore a file from the Trash, just drag it out of the Trash. Or click it once and hit Command-Backspace. The file will be put back to whatever location it was in before it was in the Trash.


You are correct about moving vs. copying files. Dragging a file from one volume (i.e. disk) to another will make a copy of it. Dragging a file from one location to another on the same volume will move it, except when the user permissions do not allow the original file to be moved (such as applications or system files). Then a copy will be made.


To delete a single item from the Trash, move everything out of the Trash that you don't want deleted, and then empty the Trash. Don't put files in the Trash that you are wanting to keep. Create a "purgatory" folder to stash files that you think you no longer want but can't bring yourself to delete just yet.

May 5, 2012 12:13 PM in response to WZZZ

Kurt, some good keyboard acrobatics needed for that maneuver. But no problem for any virtuoso pianist who can span three octaves with one hand. 😉

Nah! It's very easy. Left index finger on the left Command key, right hand on on the backspace key. Press. That moves everything into the trash. With your left index finger already on the Command key, it's a very quick move to just add the Option key with the middle finger, and the Shift key with the third finger since they're already basically hovering over those keys. Right hand is already still over the Backspace key. Press again to empty the trash.


It sounds clumsy when you type out how to do it, but with just a little practice, you'd be surprised how fast it is. I t'wern't kidding about doing both keystrokes in one second. 🙂

May 5, 2012 1:18 PM in response to bamim2

OK, TRASH exists within the relm of the Finder application. The .Trash folder (directory) in your home folder is the accumulation of file(s) on the boot volume and the file(s) (including folders) that exist on other mounted volumes- /Volumes/<volume_name>/.Trashes/<your user id>/ folder (directory). So, when you trash a file(s) on the boot volume the file(s) are moved in your .Trash directory (folder) in your home folder, on other mounted filesystems (volumes), the file(s) are moved to the /Volumes/<volume_name>/.Trashes/<your user id> directory (folder).


There isn't an option (as far as I know) to selectively remove files once they are in their respective trash folder.

May 5, 2012 2:03 PM in response to Mark Jalbert

Mark Jalbert wrote:


There isn't an option (as far as I know) to selectively remove files once they are in their respective trash folder.


Removing single items from the Trash can be done by right-clicking the file and selecting 'put back' from the context menu.

If the option isn't offered, you'll need to manually drag it out.


Emptying the Trash from the Dock empties all trashes on all mounted volumes that the user has permissions for.

i.e., emptying the trash from one account won't empty the trash for another user account.

May 5, 2012 2:57 PM in response to bamim2

WOW!! You guys are AWESOME!! Thank you for all of this. It's going to take me a while to sort this out, but there's a lot of great stuff here.


Maybe I missed it, but can somebody also help me with the "move" rather than copy, please? I'm also having problems leaving crap behind because when I'm trying to move files, I end up just copying them & (obviously) I still leave stuff behind. In Windoze I can just right mouse (although I'm a lefty, so it's "other mouse") button drag a file, then choose 'move'. Can I do a command button drag or something to move a file rather than copy it? I guess I could just try it & see what happens...


I'm an old UNIX guy, so I'm OK with the Terminal too, but I've hosed myself PLENTY of times doing stuff from the command line. No pain no gain though, eh? I mean, what fun is it without a little danger once in a while?


THANK YOU ALL for all of these ideas though. This is GREAT stuff.

May 5, 2012 3:05 PM in response to bamim2

Can I do a command button drag or something to move a file rather than copy it?

Yes. As with Windows or Mac, any file or folder on the same drive/partition will always move by default. Any file/folder on a different drive/partition will always copy. To change that behavior:


1) On the same drive/partition, hold down the Option key and it will force a copy rather than move. (You'll get a plus sign next to your cursor)


2) On a different drive/partition, hold down the Command key to force a move rather than copy. (The plus sign will disappear)


As noted above, this will work as long as there isn't some permissions restriction that won't allow the file to be copied or moved.

Jan 29, 2013 5:51 PM in response to bamim2

I know I am very late here... I came across this thread because:


Trying to move files on a mounted drive was copying, not moving, files between directories.


In my case this behaviour was caused by locked files and had nothing to do with being on a mounted drive!


These can be checked for by entering ls -lO in a terminal. If you need to change the locked flag from the terminal, see the chflags man page.


Otherwise, the flag is easily changed by its owner in a finder "get info" window by toggling the "locked" button under "General".


Sorry for adding to an old post, but hopefully this is useful to somebody else.

Mar 24, 2013 11:33 AM in response to bamim2

Hi guys! ive been trying to delete a pretty huge iphoto library. its in the 500+ GB. i have 400 gb of hd space left. empyting the trash bin's taking very very long. is there some other way to do this instantly? ive tried the procedure in Terminal described by Wzzz but im getting an illegal option warning. is there some other and faster way to delete this?


thanks!

How do I delete files & bypass the Trash?

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