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

Empty a non-emptiable trash can System
I tried everything I knew, or could find via Help, to get permission (booted in OS 10.0.3) to empty my trash, without success, including reinstalling OS X. I noticed something peculiar (after much trial and error): when first booting under 10.0.3, the Trash icon would show as empty, but as soon as it was clicked on, it appeared full.

Here's how I got things back to normal: while booted under X, I opened the trash (successfully), then double-clicked on the "Desktop (System 9)" folder and created a new folder. I then Selected All files in the OS X trash and dragged them to this new OS 9 folder.

The move was successful, and since then the OS X trash has behaved normally. The next time I booted under OS 9, I dragged the new folder (filled with OS X trash) to 9's Trash and successfully emptied it (using Option/Empty Trash, as some files were locked). I regained the appropriate amount of disk space, and the problem has not recurred as of this posting.

I don't know, but suspect, what happened: I think I must have put some files that originated under OS 9 into the OS X trash.
    •    
  • Currently 4.50 / 5
  You rated: 5 / 5 (2 votes cast)
 
[19,036 views]  

Empty a non-emptiable trash can | 19 comments | Create New Account
Click here to return to the 'Empty a non-emptiable trash can' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
The nasty uchg file flag
Authored by: Anonymous on Jun 11, '01 12:15:29AM

I had an identical problem, and I discovered that by opening up a terminal session and doing an ls -lo (long output, display "file flags") that the un-deletable files had a flag of "uchg" (unmutable) meaning they could not be changed or deleted without first clearing the flag.

To remedy this, use the chflags command with the "nouchg" parameter to clear the flag. You may have to be root to execute the command. You should then be able to remove (rm) the offending files easily.

Check out the chflags man page for additional details.



[ Reply to This | # ]
The nasty uchg file flag
Authored by: dperetti on Jun 20, '01 03:32:46AM

The command is :
chflags -R nouchg *



[ Reply to This | # ]
Wish I had tried it. . .
Authored by: Rampico on May 07, '02 06:51:02PM

I had the "invalid sibling link" and ran it through DiskWarrior. I got a bunch of files (aliases to no known file) that would not delete. As root (logged in, not su) the "Locked" box was checked and I couldn't change it.

I finally booted to 9 just to unlock and trash them.

Next time I'll try this. Thanks!



[ Reply to This | # ]
OS X's Problems
Authored by: _merlin on Jun 11, '01 08:27:53AM

Mac OS X has trouble deleting files from the trash in a number of situations. These include a file that was created and locked in Mac OS 9, and files with non-English characters in the names. Mac OS X has other problems, as well. Try double-clicking on a file with Devanagari script characters in its name. You'll get a file not found error. This really needs to be fixed.

Vasantha Crabb



[ Reply to This | # ]
If you have root enabled ...
Authored by: Anonymous on Jun 11, '01 06:02:36PM

You can just cd to .Trash/ and rm them. Thats what I always do. Why would those flags get set that way?



[ Reply to This | # ]
Re:If you have root enabled ...
Authored by: _merlin on Jun 11, '01 08:23:53PM

Even the superuser can't remove a file with the uchg flag set. When you lock a file, Mac OS X sets this flag. The whole idea of locking is to prevent a file from being modified or deleted after all.

Vasantha Crabb



[ Reply to This | # ]
Still can't delete it
Authored by: Anonymous on Jun 12, '01 08:12:15PM

I have a folder in my trash can that always says that it's in use, and so it can't be deleted. I can't move it (get the "File is in use" error), can't delete it, or do anything with it. I can duplicate it, and the duplicates behave normally and can be deleted. I can even rename the folder with no problems. But I am unable to delete it, and a search of my hard drive cannot find it. It is not located in any of my .trash or trash folders, even when I do an ls -a or -lo from the terminal. This is really frustrating, and incredibly odd, as it doesn't seem to exist anywhere on my harddrives. When I log into other accounts, including root, the folder doesn't seem to exist anywhere. But when I log into my admin account, the trash at first appears empty, but when clicked upon, it becomes full, and the folder is present. I am at a complete loss and have tried everything to get rid of it. Please help me!

wiseweasel@mac.com



[ Reply to This | # ]
Re: Still can't delete it
Authored by: Anonymous on Jun 13, '01 07:35:14PM

1) Launch terminal, and su to root.
2) Type "rm" followed by a space
3) Click on the trashcan to open up the file window
4) Drag any of the "undeletable" files into the terminal window
5) Click once in the terminal window

In your terminal window, you should now see something like:
[localhost:/Users/myname] root# rm '/Users/myname/.Trash/filetobedeleted'

6) Hit RETURN and the file should be deleted.

Note that by dragging the filetobedeleted into the terminal window, the path is revealed. As in UNIX convention, the dot in front of Trash means the file is hidden, unless you do an "ls -a" (for ALL files).

Watch out for flags too. I suggest using "ls -loa" to see every file with all the necessary information. See my earlier post concerning the uchg flag.

Good luck.



[ Reply to This | # ]
Still can't delete it
Authored by: alcepom on Jan 15, '07 07:19:18AM

I have the same problem. Did you foud the solution? Could you share it with me?



[ Reply to This | # ]
Trash and Terminal
Authored by: J0l on Sep 10, '01 07:31:12AM
Yep dragging the file from the trash into the terminal works great as it then shows the full path. Just edit it to add rm -rf (it there are directories involved, f =forced). i.e I have a file on a different drive dropping the folder from the Trash gave me this:

[localhost:~] root# /Volumes/Current-Work/.Trashes/501/SawmillRoot

so I just altered this to:

[localhost:~] root#cd /Volumes/Current-Work/.Trashes/501/SawmillRoot

cd .. (to get up a directory)

then typed rm -rf SawmillRoot

Notice I was root at the time, so before I did this to get to root I typed

sudo tcsh (my current shell)



[ Reply to This | # ]

Trash and Terminal
Authored by: nickair on Sep 11, '01 06:29:16PM

I had exctely the same problem. Even the rm -rf command in the terminal didn't work, although I was logged in as root. Finally, I tried to look at the informations via the Finder (command-i on the selected file), and saw that the file was locked. I just unlocked the file, dragged it back to the trash, and emptied it successfully!!!

Remember to check that if you have the problem...



[ Reply to This | # ]
Undeletable SMB Trash
Authored by: shacker on Dec 16, '01 05:29:59PM

If you're mounting SMB volumes from OSX and can't empty the trash, the tricks here won't help - you just get "Operation not supported" when trying to use chflags.

Instead, go to or ssh into the *nix box hosting the SMB share and look for the .Trash directory and ._.Trash file in the root of the share. Delete these with rm -Rf and the OSX trash will empty seconds later.

If your SMB shares are on a Win machine you should be able to use similar techniques.



[ Reply to This | # ]
HOW-TO movie
Authored by: oeyvind on Mar 24, '02 10:56:34AM
Guys, I got tired of answering this question..again and again. So made this how-to movie. Pretty safe, even for the UNIX inclined folks.

[ Reply to This | # ]
Your method didn't work for me...
Authored by: kcjones76 on Apr 06, '02 09:12:18PM
I temporarily switch to root typing su root here:
myname% su root

then I input my root pass when prompted:
Password:*********

With root privs, I type rm - rf, followed by dragging the pesky file onto the terminal:
root# rm -rf /Volumes/PocketDrive_20gig/.Trashes/501/Titanium4gig

The result is not what I'm looking for. I truncated the list because there were about 75 "iNode" files residing in the same directory showing the same result as line 1 listed below:
rm: /Volumes/PocketDrive_20gig/.Trashes/501/Titanium4gig/????HFS+ Private Data/iNode1008366292: Operation not permitted
rm: /Volumes/PocketDrive_20gig/.Trashes/501/Titanium4gig/????HFS+ Private Data: Directory not empty
rm: /Volumes/PocketDrive_20gig/.Trashes/501/Titanium4gig: Directory not empty

I've attempted to use BatChmod, SuperGetInfo, FileXaminer and no luck. Is the directory called ????HFS+ Private Data valid? I thought ? marks were okay. Can some one please help?! The files don't show up under OS9. If I start up without the PocketDrive plugged in, obviously they don't show up. When I used FileXaminer I was able to point to the file using the Super Delete... menu command. It responds by saying it has succeeded, but the problem file are still there...

Help me please?!

[ Reply to This | # ]
Your method didn't work for me...
Authored by: oeyvind on May 07, '02 07:45:50AM

I think your filesystem need some repairing... boot into single user mode (startup your machine and hold down Command and S keys)

# fsck -y

Until you see nothing is wrong anymore.

If fsck fails to finish all the error try DiskWarrior.



[ Reply to This | # ]
HOW-TO movie
Authored by: choard on Jul 11, '02 01:22:06AM

T H A N K Y OU! nice movie and of the dozen or so Trash messages, this one actually worked!



[ Reply to This | # ]
HOW-TO movie
Authored by: mdp on Aug 04, '02 06:11:17PM

Really clear instructions--thanks. However, I got "access denied" as a response to dragging the offending folder from the Trash. Any suggestions? I thought sudo would give root level access.



[ Reply to This | # ]
Directory not empty
Authored by: dhalterman on Sep 24, '02 11:58:33AM

I tried doing things according to the movie but I get a "Directory not empty" error. There doesn't appear to be anything in the directory after a ls -a command. Please help.



[ Reply to This | # ]
HOW-TO movie
Authored by: ekimsknird on Oct 16, '03 05:22:31PM

Ok, So how about THIS permission/trash issue:

I create a folder on the desktop and toss it in the trash and then I get a permission error when I try to delete! STupid! This is a 3 day new G5 with the latest updates.

However, I can delete anything in the .Trash folder in terminal without even being root or superuser. (As the same user who just tried to empty the trash in the finder interface.)

Mike



[ Reply to This | # ]