Determining if files are open

I have some files that are sitting on a folder on an NT Server. From my Win95/98 workstation I would like to determine if the files are currently open by another user. I would appreciate any source code or suggestions that anybody would have.
Sanju043097Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
vikiingConnect With a Mentor Commented:
Try to open the file this way:

   On error resume next
   Open "filename.ext" for input lock read write as #1
   errcode = err        'Catch possible error
   Close #1
   If errcode=70  then      '70 = Permission denied
       <file is open by another user>

It's possible the so-generated error (if the file is already open) be a different number, so first run the program without On Error and see what happens.

0
 
Sanju043097Author Commented:
Thanks, that worked great.
0
 
vikiingCommented:
Sanju: with that piece of code, ┬┐is really 70 the error value you get?. I was not sure, then I suggested the most probable one.

0
All Courses

From novice to tech pro — start learning today.