Search This Blog

Tuesday, February 23, 2010

You can't empty the Trash or move a file to the Trash


In Mac OS X, each user account has a separate, invisible Trash folder that is in the home folder. When you view contents of the Trash, you see only items you placed there and not the Trash folder of any other accounts. If other writable volumes are present, you may also have individual Trash folders on these volumes.

How to delete a file

  1. Drag an item's icon to the Trash (in the Dock), or select the item and press Command-Delete.
  2. Choose Empty Trash from the Finder menu.

Note: If you're trying to delete a file that wasn't completely downloaded or copied, check out this document.

Tip: In Mac OS X 10.3 or later, you can securely delete items by choosing Secure Empty Trash from the Finder menu.

If you change your mind about deleting the item before you choose Empty Trash:

  1. Click the Trash icon in the dock.
  2. Drag the item out of the Trash.
     

If you can't empty the Trash or move a file to the Trash

For example, this message might appear when you try to empty the Trash: "The operation could not be completed because the item '(item name)' is locked."

First, try holding the Option key as you choose Empty Trash from the Finder's File menu.


Otherwise, check for these conditions:

  • Is the file locked?

    If files are locked, unlock them before deleting or delete using the tips in the "Deleting locked files" section below. Also, see this article.
     
  • Do you have correct permissions to modify the file?

    Every file and folder in Mac OS X has some permission settings to help define what you or other users can do with the file or folder, for example whether you may modify it or not. If see an alert box with a message that says you do not have "sufficient" privilege or permission, see the tips in the "Emptying the Trash" section of this article.
     
  • Does the file or volume have special characters?

    Usually, Mac OS X can delete files whose names contain special characters, but sometimes you might need to follow this advice.

    1. Note the name of the volume which the files are being deleted from. If you are not sure of the item's location, you can verify that by selecting it then choosing Show Info from the File menu. If the name of the volume contains any special ASCII characters, such as a bullet or trademark character, temporarily rename the volume so that it does not contain these characters.

      Example: If you cannot delete files from a volume named "·Dox", rename the volume to "Dox". After the Trash is empty, restore the volume's original name as desired.
       
    2. Examine the name of the files or folders you cannot delete. They should not contain a solidus ("slash", "/") character or any other special ASCII character such as a trademark, quotation mark, or copyright symbol. If the file does, remove the special character or slash from its name, then delete it.

      Example: If you cannot delete a file named "Things/stuff·", rename the file to just "t", then delete it.


Deleting locked files

Locked files can easily be deleted if you press Shift-Option or Option key combination while emptying the Trash (in Mac OS X 10.1 and later). For Mac OS X versions 10.0 to 10.0.4, use Show Info to deselect the item's Locked checkbox.

If you still cannot delete the item, start up your computer from the Mac OS X installation disc and choose Disk Utility from the Installer menu of the first screen. Use Disk Utility to verify and, if necessary, repair your disk.

If a file can't be unlocked, you may not have permission to unlock it. See this article to learn how to get write permissions.

If the issue persists, use Disk Utility's Repair Permissions feature to check your Mac OS X volume. For Mac OS X 10.1.5 only, download and use Repair Privileges Utility 1.1 instead.


Advanced tip about deleting locked files

If there are several locked files in the Trash, you can unlock them all at the same time at the command line. Follow these steps:

  1. Open Terminal. It's located in /Applications/Utilities.

    Type: chflags -R nouchg

    Note: Type one space (not pictured) after nouchg in the line above, so that it ends in "nouchg ". Do not press Return yet.
     
  2. Double-click the Trash icon in the Dock to reveal the contents of the Trash. If necessary, arrange the Finder window so that a portion of the Terminal window is still visible.
  3. Press the Command-A key combination to select all files in the Trash.
  4. Drag the files from the Trash to the Terminal window.
    Note: This automatically enters the pathname for each file. This eliminates the need to individually empty multiple Trash directories, particularly when multiple disks or volumes are present.
  5. Press Return. No special text message will be shown indicating that the command was successful.
  6. Empty the Trash.

If the Trash does not empty or if you see a message in Terminal that says "usage: chflags [-R [-H | -L | -P]] flags file..." you most likely did not type the text in step 2 as indicated or did not leave a space. Repeat the steps if this happens.

No comments: