14 Replies Latest reply: May 29, 2014 10:55 AM by machyavelly
William @ Quebec Level 1 (0 points)

I'm Trying to delete Files on my USB drive that is connected to the Apple base station..

 

But get a error message saying: "The operation can’t be completed because the item "xxx.jpg" is in use."

 

I tried all the files the same thing. I plugged the drive directly into the mac to do a disk utility app the only thing I can select is Verify disk and it was okay.. But could not select repair permission option??

  • softwater Level 5 (5,370 points)

    The easist way to solve this is Shutdown the computer, with the drive still connected.

     

    After shutdown, remove the drive from the mac, then startup.

     

    After startup has finished, connect the drive to the computer (not the base station) and delete the files.

  • William @ Quebec Level 1 (0 points)

    It worked?? Why?? I tried almost everything!! Thank you.. to simple though..

  • Topher Kessler Level 6 (9,865 points)

    When programs open a file they put a filesystem lock on it to prevent other programs from editing the file at the same time. This is usually a quick lock so the file can be read into memory, and then the lock is released; however, there are times when a program needs to maintain a lock, or times when a bug might prevent the lock from being released. When this happens if you try to edit or delete the file the system will not allow it and will issue you the "in use" error. Fixing this requires quitting and relaunching of the application, but if you cannot figure out which application it is (or if it is a background service in OS X), then as softwater mentioned the easiest solution is to reboot the system. This will cause all processes in OS X to release their filesystem locks and re-initialize, and therefore clear the problem.

  • softwater Level 5 (5,370 points)

    It wouldn't work before because some process was still running that was holding those file addresses in memory.

     

    The easiest way to solve that is to keep the files connected and kill every process to release them from memory (which is what you did by doing 'Shutdown').

     

    Of course, you can do it without shutting down if you know precisely which process(es) are causing the problem. Sometimes, that's as simple as quitting the last app that you used to read then, but other times, there are hidden processes going on that continue even when you quit the App's user interface.

     

    Hence, a complete shutdown is often easier and always effective!

  • softwater Level 5 (5,370 points)

    If by 'reboot' you mean 'restart', I'm not sure that will always work in Lion, given all the Resume, App Saved States, Reopen Windows etc processes. That's why I suggested 'shutdown' and remove the disk before booting up is a safer bet.

  • Topher Kessler Level 6 (9,865 points)

    The "Resume" feature is separate from file locks. Resume just stores a document/window configuration for each program and will read this to restore the workflow as-is (using auto-saved files, etc.) when the program is next launched. The file lock issue happens below this, where any time an active program accesses a file (be it in an auto-resume configuration, a user-opened document, or otherwise) it will place a lock on it while the read/write process is happening, and then should release this lock if programmed properly.

     

    Shutting down or restart/rebooting will do the same thing with regards to the file locks. Both processes will require all programs to quit and thereby release any current file locks they may have.

  • softwater Level 5 (5,370 points)

    Ah, OK. I think I get it now. Thanks for taking the time to explain.

     

     

  • William @ Quebec Level 1 (0 points)

    Wow, Thank you for the Info..

     

    I don't understand why this would happen when connected to Apple base station though.

  • William @ Quebec Level 1 (0 points)

    Nope not working, reconnected USB drive to Apple Base station problem still there...

  • amitchauhan274 Level 1 (0 points)

      Just open Terminal and

      type : sudo rm -rf <file-name-appers-by-drag-and-drop-from-trash>

       This Will solve the problem. No need to shutdown.

     

    Screen Shot 2013-05-14 at 9.22.41 PM.png

  • zendary Level 1 (0 points)

    amitchauhan274....legend!

     

    This was an excellent fix.  Thought I was back in a windows world with the other above answers, having to shutdown and reboot!

     

    Cheers.

  • Topher Kessler Level 6 (9,865 points)

    The only time to use the -r flag in that command is if you are deleting a folder with items in it. Otherwise leave this flag out as it will recurse through folders and remove all items within the targeted location. If for some reason you make a mistake in your syntax in targeting a single file, then you can inadvertently remove a large number of files if you include the -r flag.

  • zendary Level 1 (0 points)

    Hi Topher,

     

    Nice update. Thanks for the info as that is very handy to know.

     

    Cheers.

  • machyavelly Level 1 (0 points)

    I have found a better solution

    open Activity Monitor and find "diskimagehelper" and kill this. and Done