Checking to see if a file is in use

I am using filewatcher to watch a specific directory for new files.  Once a new file is created I can fire off a procedure but I want the procedure to wait unti the file is no longer in use.  Wether that means being copied or created.  I know in c# the "isfileinuse" is available does anyone know of anything like that for
Who is Participating?
käµfm³d 👽Commented:
I'm not aware of that function in C# either. I think if you saw it posted somewhere, then it is a user-created function and not something that is inherent to the Framework.

I also agree with CodeCruiser with regard to catching the exception.
I am not aware of any IsFileInUse function in C#. You would have to try to open the file and handle the exception if its in use.
rxresultsAuthor Commented:
Thanks guys.  I thought that was too easy.
käµfm³d 👽Commented:
I think the points should all go to CodeCruiser. He answered the question; I was just agreeing with him  : )
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.