How do I delete locked files?

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

  1. Proto Media macrumors member

    Joined:
    Apr 25, 2006
    Location:
    Gnar Cal
    #1
    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

    WildCowboy

    Staff Member

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

    Joined:
    Aug 16, 2006
    Location:
    Toronto
    #3
  4. pianoman macrumors 68000

    pianoman

    Joined:
    May 31, 2006
    #4
    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

    skunk

    Joined:
    Jun 29, 2002
    Location:
    Republic of Ukistan
    #5
    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

    Joined:
    Dec 21, 2002
    Location:
    Yahooville S.C.
    #6
    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

    Joined:
    Apr 25, 2006
    Location:
    Gnar Cal
    #7
    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.

    GOOD DAY!
     
  8. paxx macrumors newbie

    Joined:
    Nov 23, 2006
    #8
    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.

    Pax
     
  9. nichos macrumors 6502

    nichos

    Joined:
    Jul 17, 2004
    Location:
    Jacksonville, Fl
    #9
    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

    Transeau

    Joined:
    Jan 18, 2005
    Location:
    Alta Loma, CA
    #10
    sudo rm -rf ~/.Trash/*

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

    theblotted

    Joined:
    Nov 10, 2006
    Location:
    Los Angeles
    #11

    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

    whipstitch

    Joined:
    Dec 5, 2006
    #12
    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

    Joined:
    Nov 23, 2006
    #13
    Glad it helped!!
     
  14. cinema1965 macrumors newbie

    Joined:
    Apr 23, 2009
    #14
    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

    Joined:
    Apr 23, 2009
    #15
    thread shows oldest up tp

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

    Joined:
    Jul 4, 2007
    #16
    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

    Joined:
    Apr 23, 2009
    #17
    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

    Joined:
    Jul 2, 2009
    #18
    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

    Joined:
    Oct 13, 2001
    Location:
    Seattle, WA
    #19
    It won't go into the trash...
     
  20. lannister80 macrumors 6502

    lannister80

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

    Joined:
    Dec 6, 2010
    #21
    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

    Joined:
    Dec 13, 2010
    #22
    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

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

    derbothaus

    Joined:
    Jul 17, 2010
    #24
    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