Find out which network user is using a file, causing “The operation can’t be completed because the item … is in use”

finderms officeNetwork

So, normally, if you run into the error "The operation can’t be completed because the item ... is in use" while trying to modify a file, you look up what is using the file with sudo lsof | grep <filename or part of filename>.

I'm having a problem where this doesn't work. The file in question is on a shared network drive (Active Desktop I believe, or something like that). The file is not in use on my machine – the above lsof Terminal command gives nothing. So it seems that something else on the network is causing the file to be in use.

Nothing I've tried (lsof, Get Info, rebooting, force-quitting Finder, opening the file in its own application…) helps or gives any clue about why it's locked like this.

How can I find out who or what on the network is using a particular file?


Background for my specific case: for me, the file in question is one of those hidden ~$whatever.xlsx or ~$whatever.xlmx 'ghost' temporary files that Excel for Mac likes to create, which cause Excel files to become uneditable when people inevitably disconnect from the network without closing Excel.

Normally, the easy fix is to delete the ghost file. This normally works fine – but at the moment it's not working with the above error and there's no clue I can see why not.

Also, normally, opening Excel files that are locked by a user gives a message like "Locked for editting by <username>". There's no such message for this, which is unusual (but maybe just Excel for Mac being glitchy, probably not related to the general question).

On a Mac Pro running Lion (Excel for Mac 2011 in case that is relevant).

Best Answer

I have often been able to delete otherwise not deletable files by deleting the file in Terminal:

sudo rm /path/to/the/file/to/delete

Without sudo it still fails for me but ad it and files vanish like magic. If you don't know the specific unix file path just type "sudo rm " and then drag the file into the open Terminal window and it will insert the file.

Press ENTER, authenticate with your admin password and the file SHOULD vanish.