How do I delete locked files?

Discussion in 'Mac Pro' started by Proto Media, Dec 7, 2006.

  1. Proto Media macrumors member

    Apr 25, 2006
    Gnar Cal
    Ok so I had a backup drive which is just a mirror of my normal drive. I am now selling my computer and want to delete all the files off the HD and do a fresh install of Tiger before I sell it. When I go to empty the trash, it says something like there is 17,000 items in it, and about a minute in it says "cannot delete said item because said item is in use"

    This is AFTER I reinstalled Tiger. I chose the erase destination disk first, then install, thinking it would trash all these locked files, but after rebooting, my trash is still full of the same files that were on there before I did the re Install.

    Does anyone know how to just like, blast the trash or something, some force trash command or something, maybe something with terminal? These files are taking up like 20 GB of room and I would really like to get them off of there before I go and sell the computer.

    It is a dual 2Ghz PMG5. I know I can go into eash individual file and unlock it, I think thats whats causeing the problem cause I think they are like application files or something and the computer thinks that it needs them so it wont let them be deleted, but I would prefer not to have to unlock 17,000 files.

    Any help is greatly appreciated. Thanks in advance!

    - Ryan
  2. WildCowboy Administrator/Editor


    Staff Member

    Jan 20, 2005
    I'm not sure I follow everything you said, but try using "Secure Empty Trash" from the Finder menu.
  3. PkennethV macrumors 6502a

    Aug 16, 2006
  4. pianoman macrumors 68000


    May 31, 2006
    i'm not sure i understand either, because doing a fresh install should erase everything. if nothing else, try reinstalling the OS again and select the option that clears the hard disk (if you haven't done this already). perhaps also try reformatting the hard disk (which will erase everything on the disk) using the installation CD and then going through with installing the OS.
  5. skunk macrumors G4


    Jun 29, 2002
    Republic of Ukistan
    If you put all the items in the trash into a folder on the desktop, you can then highlight the folder, click Cmd+I, uncheck the locked file box and click on "apply to all enclosed items". Then try trashing them again. That might work. I think.

    Alternatively, I might be talking complete bollox. :eek:
  6. Dont Hurt Me macrumors 603

    Dont Hurt Me

    Dec 21, 2002
    Yahooville S.C.
    Use the file tab after being in that program thats locked, use get info to get access from there you can unlock it. Then trash it . At least thats how I remember it. or try skunks way.
  7. Proto Media thread starter macrumors member

    Apr 25, 2006
    Gnar Cal
    PkennethV you are the Sh** Thank you so much for that link, I downloaded the software, and now those 17,000 files are gone! Thanks again so much you have no idea how much you have helped someone out. And thank you to all of the other people that replied.

  8. paxx macrumors newbie

    Nov 23, 2006
    I realize that your problem has been solved but here is another way to skin that "delete locked file" cat.

    Hold down the option key as you empty the trash from either the Finder menu or while pressing shift/alt/delete keys.

    Holding the option key will delete any locked files that are in the trash.

  9. nichos macrumors 6502


    Jul 17, 2004
    Jacksonville, Fl
    This happened to me before. I ended up going to the terminal and:
    sudo rm -rfv /Path/To/File/FileName

    of course, trash is in ~/.Trash. In that case you'd want to:

    rm -rfv ~/.Trash/*

  10. Transeau macrumors 6502a


    Jan 18, 2005
    Alta Loma, CA
    sudo rm -rf ~/.Trash/*

    this is exactly what I do too.
  11. theblotted macrumors regular


    Nov 10, 2006
    Los Angeles

    i've tried this before and it doesn't work everytime. at times it'll say "not permitted".

    this is when i reveal all hidden files that are locked, and unlock'em manually.
  12. whipstitch macrumors newbie


    Dec 5, 2006
    AWESOME. Been using Terminal and a bunch of commands I don't understand, like "sudo rm -r /~ ...." and NOTHING. The files won't delete. Held option and BOOYAH. BOOOOOYAH!
  13. paxx macrumors newbie

    Nov 23, 2006
    Glad it helped!!
  14. cinema1965 macrumors newbie

    Apr 23, 2009
    How do I delete locked files?

    I've noticed that this thread is kind of old, but it is still there on google search results. After hours of trying many different things to try to delete thousands of LOCKED files from my computer, I came across a way to do this without having to download or buy anything, Mac computers are the best. Here is a step-by-step different solution for this problem.

    1. Open Applications....... Utilities ....... Terminal
    2. Copy and paste ( chflags -R nouchg ) inside terminal screen. do not press return yet
    3. Open trash bin
    4. Press command-A to select all files at once
    5. Drag them all inside the Terminal screen
    6. Press return
    7. You are done! close everything. open trash and delete all your files.

    It is so easy. I am sure someone out there will know a better way.... I wish they had posted before. I spent 4 hours trying to get rid of those damn files. I hope you find this thread for this will put a smile in your face.:)
  15. cinema1965 macrumors newbie

    Apr 23, 2009
    thread shows oldest up tp

    Perhaps, someone can teach me how to set up newest thread replies up top...:eek:
  16. awmazz macrumors 65816

    Jul 4, 2007
    Did you not try holding down the option key while emptying the trash? It seems the easiest solution and works every time for me.
  17. cinema1965 macrumors newbie

    Apr 23, 2009
    I have a 1 year old MacBook Pro and it does work at all. Is there a box I should check somewhere in the system preference folder?
  18. a4cab03 macrumors newbie

    Jul 2, 2009
    Thanks a bunch Cinema.
    Your method works great.

    I had a couple of locked files on my USB shared drive (through the airport) that prevented me from deleting everything on the drive.
  19. floatingspirit macrumors 6502

    Oct 13, 2001
    Seattle, WA
    It won't go into the trash...
  20. lannister80 macrumors 6502


    Apr 7, 2009
    Nuke from orbit, it's the only way to be sure they're deleted.
  21. tbeez macrumors newbie

    Dec 6, 2010
    Solution to deleting locked files on Mac

    If your files will not go to the trash
    1. Select the folder they are in,
    2. Select File: Get Info:
    3. Click the lock at the bottom to unlock.
    4. To the left of that, there is a gear with a menu arrow to the right of it. Click on the arrow, then click: Apply to enclosed items.

    This should unlock the items you want to delete.
  22. neggsm macrumors newbie

    Dec 13, 2010
    Try this...

    Go to Finder, choose "Secure Empty Trash" and begin holding the option key until the trash is completely emptied.
  23. duswdav macrumors newbie

    Apr 4, 2011
    its 2012 and this still works :)
  24. derbothaus macrumors 601


    Jul 17, 2010
    Just use this to clear the lock, works every time. In case you want the lock gone but the file to remain.

    chflags -R nouchg /path/to/the/offendingfile

Share This Page