Trashing locked files?

Discussion in 'OT Technology' started by Labster, Dec 3, 2009.

  1. Labster

    Labster OT Supporter

    Joined:
    Sep 21, 2003
    Messages:
    5,717
    Likes Received:
    0
    Location:
    NE, OH
    I tried to erase my old time machine backup and it won't work. Anyone know any way to get around this? It asks if I want to erase locked items and I click yes and it doesn't work. wtf?
     
  2. SofaKingKong

    SofaKingKong New Member

    Joined:
    Oct 29, 2009
    Messages:
    332
    Likes Received:
    0
    Location:
    Citrus Heights
    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.
     
  3. Labster

    Labster OT Supporter

    Joined:
    Sep 21, 2003
    Messages:
    5,717
    Likes Received:
    0
    Location:
    NE, OH
    Comes back saying permission denied. wtf. I'm the administrator. I don't get it.
     
  4. Labster

    Labster OT Supporter

    Joined:
    Sep 21, 2003
    Messages:
    5,717
    Likes Received:
    0
    Location:
    NE, OH
    MacShack actually let me down... :wtc:
     
  5. mobbarley

    mobbarley Active Member

    Joined:
    Mar 4, 2005
    Messages:
    9,256
    Likes Received:
    2
    Location:
    Sydney
    pfft option + delete works, if not you have something screwey going on, sudo rm .... from the terminal.
     
  6. Labster

    Labster OT Supporter

    Joined:
    Sep 21, 2003
    Messages:
    5,717
    Likes Received:
    0
    Location:
    NE, OH
    so I restarted my computer a couple of times and erased the trash without any problems :dunno:
     
  7. Labster

    Labster OT Supporter

    Joined:
    Sep 21, 2003
    Messages:
    5,717
    Likes Received:
    0
    Location:
    NE, OH
    wtf is pfft option?
     
  8. Fucker

    Fucker out of the fast lane, bitches

    Joined:
    Jan 28, 2005
    Messages:
    11,538
    Likes Received:
    0
    Location:
    The Left Coast
  9. DouggieJ

    DouggieJ OT Supporter

    Joined:
    Nov 1, 2007
    Messages:
    8,126
    Likes Received:
    0
    Location:
    New York, NY USA
    If all else fails

    sudo rm -rf [file or directory name(s)]

    in the Terminal
     

Share This Page