MacSTAC was founded on April 1, 1978 as an Apple II MUG. We are a community group with members from all walks of life, careers and levels of ability. We welcome all Mac users to improve their knowledge and, in turn, share their Mac knowledge with others. http://macstac.org

Tuesday, October 28, 2008

Cannot empty the trash

Several users have reported an issue in which files cannot be deleted from the Trash. Sometimes users may intentionally move files to the trash and then perform some operation that inadvertently renders them inaccessible, and other times, rogue files may just appear in the trash. MacFixIt has covered some of these situations in the past, in which files appeared due to problems in Windows Boot Camp partitions, or bizarre permissions problems prevented deletion. In addition to these situations, there may be problems with file name structure that prevents OS X from properly accessing them.

Apple Discussions poster CEO72 writes:

"I have been trying to get rid of a file for a couple of weeks now. It's a very strange looking file that starts out with a bunch of symbols that I thought at first looked like Japanese but when I looked closer it seems like some sort of hieroglyphics or something. The file is dated December 1903. I've tried renaming it and I get error. I've tried dragging it out of the trash only to have it disappear and reappear later. I've tried many of the force empty trash techniques like holding down option and doing it."

In addition to various Finder-related methods for removing the file, this user attempted several Terminal commands to directly target and remove the offending file. These did not work either, and upon trying to access the file either for rename or removal the system would give errors claiming the enclosing folder is not empty or would just not do anything.

When files are placed in the trash by the system, they're removed from their original folder and are placed in a hidden temporary folder called ".Trashes" that is at the root of the drive containing the offending file. In instances in which the trashed files disappear upon ejecting an external drive, the files are located on that drive in the ".Trashes" folder. As such, in order to remove the files users must target the files in that hidden directory, and there are many ways to do this.

Fixes

Use Finder-based methods for removing the file If the system provides an error regarding permissions or "locked" status of a file, users can force the trash to be emptied by holding the options key down when right-clicking the trash to empty it. This should fix most problems in which trashed files are being stubborn. Alternatively, users can try using the "Secure Empty Trash" feature available in the "File" menu in the Finder.

Use Terminal-based methods for removing the file In past cases where files have not been removable even via alternate Finder-based empty trash commands, users have been able to empty the trash with terminal commands. Users can enter the following command to remove the files:

  • Open the Terminal application
  • Enter the following: sudo rm -rf (followed by a single space)
  • Open the "My Computer" Finder window that contains the list of mounted drive volumes
  • Drag the hard drive containing the file into the Terminal window. This will input the drive's path to the command line ( NOTE: If the drive containing the file is unknown, perform this whole procedure for all available drives.)
  • When this is done press backspace ONCE to remove the space at the end of the line.
  • Enter "/.Trashes" at the end of the line and press return. It is VERY important that this is entered at the end of the line.
  • Authenticate and the files should be removable.

Repair the volume File access can be limited if users have a corrupt filesystem or disk structure, and it is encouraged to use utility software to repair the drive. Apple provides Disk Utility, which can detect most common errors, but a more robust solution would be DiskWarrior. Users might have to boot off another volume (such as the Leopard DVD) to properly run a drive fix.

Run Windows-based disk utilities for Boot Camp users There is a situation in which "ghost" files in the trash can appear because of problems on a Windows Boot Camp partition. In this case users should boot into the Windows partition and schedule a "chkdsk" routine by right-clicking the "C:" drive and getting properties. Next, in the "Tools" tab click "Check Now" and then enable both "check disk options" checkboxes. Then click "Start" and reboot the computer when prompted. Boot back into Windows to allow the routine to run, and then reboot into OS X.

Use another operating system In some cases either the drive format, or specific attributes for that format can prevent OS X from properly reading files. When OS X creates the ".Trashes" folder at the root of the drive, if this folder is inaccessible due to some formatting problem then users will not be able to delete files. Many users with this problem have had this issue with external drives that were formatted to FAT32. The FAT32 format supports file tags that are not fully supported in OS X, which can lead to some problems. In these cases users may benefit from attaching the drive to a computer running another operating system besides OS X. When the drive mounts users should be able to browse the folder structure and remove the contents of the ".Trashes" folder at the root of the drive. This was the situation in the case of the user quoted above.

No comments:

Visitors

Visitors

Blog Archive