Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows - find if the file is currently open ?

Status
Not open for further replies.

MoshiachNow

IS-IT--Management
Feb 6, 2002
1,851
IL
HI,

How can I tell if the file is currently open by some application ?
thanks

Long live king Moshiach !
 
When you try to open it, you should get an error, assuming it's been exclusively locked, or you could use something like ntfilemon to see if the file is currently in use, and by which process, though you would need a command line version I'm guessing

HTH
--Paul

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
I don't know of a pure perl solution but both cygwin and the Windows Server 2003 Resource Kit (and possibly other resource kits) contain a untility called [tt]fuser[/tt], which will list the processes which currently have a given path open.

Yours,

fish

["]As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life was going to be spent in finding mistakes in my own programs.["]
--Maurice Wilkes, 1949
 
fuser is available on *nix, but needs to run with admin privileges see here

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
1."When you try to open it, you should get an error"

Not realy,when it opens with Notepad or Word,Perl is still able to open it for read.

2.fuser - did not find a Windows version yet.

thanks

Long live king Moshiach !
 
cygwin is probably your best bet then, as ghoti pointed out earlier

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top