Link to home
Start Free TrialLog in
Avatar of CASorter
CASorterFlag for United States of America

asked on

find what has a file open

i have a file that is on a shared network drive that is open by a process that is not running on the computer i am on.   i cannot delete it because of this.
is there a way i can find out what has it open?
Avatar of -tjs
-tjs
Flag of United States of America image

Couple of things to try:
If a user has it open on the share remotely:
-Computer Manager (right-click My Computer->Manage)->System Tools->Shared Folders->Open Files.  From there you can terminate a user's connection to a file but you might want to ask the user to close it first.

-Download Process Explorer from http://technet.microsoft.com/sysinternals, run ProcExp, and use Find Menu->Find Handle or DLL->type in the name of the file.
Avatar of CASorter

ASKER

did both of those already.
the only thing that shows under open files is \pipe\spoolss   about 40 times.

the file is not on this computer..  it is on a remote mapped drive

procexp only shows local processes running on this machine.

the file is a remote file, being held open by a remote process.
 i have access to the file.
it is an import file that i import and then rename when i am done.
i can read and import the file fine.
i cannot rename it.  when i try it says that the file is open.
i do not think that any proccess running on the physical machine i am on has it open.

what i think has happened is that the process used to create the file has gotten stuck and has left it open.  

i need to find out what/where that is so i can let the operator know to go to that machine and do what is needed to unlock the file.

Avatar of awawada
awawada

You will be able to delete this file with Unlocker 1.9.1 .
http://www.emptyloop.com/unlocker/#download
Avatar of Qlemo
awawada,
Don't think you can use Unlocker remotely?!

CASorter,
You can still what tjs suggested in http:#a36512163. Open the Computer Manager, right click on the root entry, and connect to the remote PC. If you have valid credentials you should be able to view the remote shares, sessions and files open. You can then close that handle.

Often a Antivirus software holds files for longer as necessary - that could be another culprit, besides the creating process.
@Qlemo
If he is having a shared network, he can map the share and delete the file from his computer!
I have done this tousend times...

like has been said you can use comp mgmnt from the computer you are on.... Or just use it direct on the server console or rdp session where the file share resides.
i RDPed directly to the computer.
opened up computere managaement there, the file in question did not show

the file is a text file.
i opened another file in notepad.

that also did not show in the open file list...
does computer management show open text files?

the only files i see as "open" are .dll and .exe files

i was able to go to the file in question, and was not able to remove it, (or rename it) even though i browsed to it on the physical drive.

That will only show what is open through shares.  I suspect then that the file may be open from the server itself then?  You can see what shares have connections too if you check the other pages of comp. management.

Have a look with openfiles.exe - that is available on XP and 2003 to my knowledge though the first time you use it you have to turn on local file object checking or something - needs a reboot afaik which of course would clear your open file anyway.

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/openfiles.mspx?mfr=true

Steve
@CASorter

Did you try Unlocker?
On the server you can use ProcExp as recommended earlier to find which process, running on the server, has that file open. You cannot do that remotely, however, ProcExp has to run on the system the processes with open files are.
ASKER CERTIFIED SOLUTION
Avatar of CASorter
CASorter
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
question not answered.
Would have followed my advice with ProcExp, you would have seen which process held the file open.
tried this.
procexp shows, as far as i can tell, running programs.. ie  processes.

it is not a process...  it is a text file.. "as mentioned earlier"

i read in the text file.
when i am done i rename the text file.

i cannot rename it because something else has it open.

i tried opening a local file with notepad, ran procexp,  searched for notepad. all that showed up was that notepad was running, it did not indicate, as far as i could see what file it had open.  i searched for the file name itself, nothing showed in procexp.

i tried opening the same file from a remote machine, when i tried to rename that file on the local machine i got an access denied message.
i ran procexp again on the local machine, put in notepad to search,  nothing showed up, put in the name of the file i had open on the other machine, nothing showed.



Notepad is special - it does not hold the file while open. If you had used e.g. Word, you should have seen it in ProcExp.
However, the second case (remote) is interesting - if there is no handle open, you should be able to rename or delete the file. If there is a handle open, it is found by ProcExp when searching for the file name.
try it.

from computer A  browse to computer B and open a text file with notepad or wordpad.

then go to computer b itself and try and rename or change and save it.  i dont think you will be able to.  

it will say access denied.

in playing with this i did successfully rename the open file on occasion, i think the locking occurs once a change to the file was made.

regardless of being able to reproduce the access denied,,  i dont think you will be able to tell who has the file open,

attached is a screen shot of me having a local file (c:\install.ini) open,
the info in the procexp screen does not contain anything referencing install.ini.



if i close the wordpad document  and redo the wordpad handle search, i get zero files.


procexpEXAMPLE.bmp
As said, neither Notepad nor Wordpad hold the file locked when open. Only if at that moment when you save, a file lock is aquired for a very short period. After that, the file is no longer shared, open, or whatever. I tried several times now on a XP system, and had no issues renaming or deleting the file locally or from remote while (remotely) opened in Notepad. Whether the file has been modified or not did not change the behaviour.
I assume there is another process holding the file, likely something like a Antivirus application. But we will never find out now.