Can't delete a folder

Discussion in 'macOS' started by Doobz, Jun 16, 2011.

  1. Doobz macrumors newbie

    Joined:
    Jun 2, 2009
    #1
    I can't delete a folder on my external hd. I'm the only user and I'm logged in with administrator access. It says it contains 0kb when I "Get Info", but when I try to delete it (it won't even let me drag it to the trash bin), I get a message saying that "The operation can't be completed because the item is in use." I've tried restarting the hd, my computer, and renaming the folder. Is there anything I can do? It's just annoying and I want it gone.
     
  2. Tyr. macrumors member

    Joined:
    Aug 1, 2007
    Location:
    Antwerp, Belgium
    #2
    Command line time ! Open your terminal and open a root shell by doing

    Code:
    sudo su -
    You will be prompted for your admin password. Next navigate to the folder containing the folder you want to delete

    Code:
    cd /Volumes/ExternalDiskName/path/to/folder
    You can check what process is holding on the the file by using the fuser command, this will spew back a list of numbers with a 'c' after them. Chop off the 'c' and use the process number as an argument to the ps command. Eg:

    Code:
    Mac-mini:~ tyr$ fuser /
    /: 82c 246c 250c 271c 275c 277c 279c 280c 281c 282c 283c 284c 285c 286c 287c 308c 314c 315c 319c 325c 366c 367c 372c 374c 379c 383c 384c 385c 387c 392c 1237c 1364c 1384c 1385c 1401c 1402c 1408c 1414c 1415c 1416c
    Mac-mini:~ tyr$ ps -p 246
      PID TTY           TIME CMD
      246 ??         0:00.26 /sbin/launchd
    If you want to delete anyway do :

    Code:
    rmdir nameofyourfolder
    
    If that one doesn't work use this :

    Code:
    rm -fr Nameofyourfolder
    
    That command is extremely dangerous by the way make sure your folder isn't a link or something, doesn't contain any spaces and you type it correctly. Unix commands aren't known for being very forgiving.
     

Share This Page