HELP!! Can't Delete File

Discussion in 'Mac Apps and Mac App Store' started by RiseAgainst, Aug 25, 2003.

  1. RiseAgainst macrumors regular

    Jun 10, 2003
    I have this file on my desktop and when i try to delete it it says, "The item <file name here> is being used by another task right now. (Other tasks include moving, copying, or emtying the Trash".

    But there is no other task using it. Iv restarted, repaired permissions, tried deleting it as root. Nothing works. I just keep getting the message. PLEASE HELP!
  2. CMillerERAU macrumors regular

    May 12, 2003
    First off, if you can boot into OS 9 then do so and delete the file that way. The OS X desktop folder is buried deep in the user's folder so it would probably be easiest just to run a file search to get to it.
  3. mnkeybsness macrumors 68030


    Jun 25, 2001
    Moneyapolis, Minnesota
    #3 time do a search...we had the same problem asked last week, the week before, the week before that...etc...

    search for "deleteit" or Delete It.


    go into the terminal, type
    sudo rm 
    and then drag the file into the terminal window (don't forget the space after "rm ".
    assuming you have administrator access, enter your password when prompted, and the file will be removed.
  4. RiseAgainst thread starter macrumors regular

    Jun 10, 2003
    Thanks mnkeybsness, the terminal worked great. Thanks again.
  5. andyduncan macrumors regular

    Jan 21, 2003
    Hold on, I was about to scold mnkeybsness for not reading the original post...

    if sudo rm <filename> was something new for you to try, what exactly did you mean in your original message when you said you tried deleting it as root?
  6. RiseAgainst thread starter macrumors regular

    Jun 10, 2003
    As in...

    Turning on root in Netinfo Manager and logging on through the log on screen as root. For some reason I was not able to delete the file through the GUI. But the terminal worked. Y is that?
  7. andyduncan macrumors regular

    Jan 21, 2003
    Re: As in...

    Good question. I generally advise against enabling root in order to obtain superuser GUI access. It's too easy to screw things up. Unfortunately the only other option in many cases is the terminal. 99.99% of the time that is the lesser of two evils.

    I'm not sure why the finder wouldn't let you delete the file while logged in as root. Theoretically it should not have a permissions problem, perhaps the finder was looking at something else, like the lock flag. Whatever it was, sudo rm <filename> should be able to delete just about anything. And while you were logged in as root, typing rm <filename> should have had the same effect as typing sudo rm <filename> as another user.
  8. Doctor Q Administrator

    Doctor Q

    Staff Member

    Sep 19, 2002
    Los Angeles
    Re: As in...

    I think it is because of a feature of all versions of Unix, having to do with how files are deleted. I'll explain the background and then my theory.

    Unix files really have two parts, which you can think of as the metadata and the data. The metadata includes the name of the file, its owner and permissions, and access dates. The data is the content of the file. The metadata is what you see in a directory listing. When a file is opened by a process (an application, a background task, or the operating system), it is the data that is in use, not the metadata.

    When you are allowed to delete a file according to its Unix-level permissions, and you use the rm command in the Terminal window, Unix deletes the metadata of the file you name. Normally, the data is deleted too. However, if any processes have the file open, the metadata is still removed but the data is marked for deletion instead of being deleted immediately. It is deleted when the last process closes the file.

    My theory is that the Finder has its own method: that if any process has the file open or if the file has properties known by the Finder that tell the Finder not to delete the file, the Finder says no and doesn't try to delete the file. So that's why the Finder fails and rm works. Utility programs that delete files ignore the Finder properties and do a Unix-level delete.

    Just to be thorough, I should mention one more detail. A given data file can actually have more than one set of metadata, i.e., a file can have more than one filename. When one file has two names, it is called a "hard link" between the names. (This is not the same as a "soft link" and not the same as a Mac OS alias.) If you use the rm command and there are hard links to the file you are deleting, the metadata of the file you name will be deleted and the data will be left as is, since it has at least one other filename pointing to it.
  9. FredAkbar macrumors 6502a


    Jan 18, 2003
    Santa Barbara, CA
    Hey that was quite informative Doctor Q, thanks for explaining it.

Share This Page