troubleshooting Question

How do you tell when a file is done writing and available for access

Avatar of MarkWThompson
MarkWThompsonFlag for United States of America asked on
Visual Basic.NET
3 Comments1 Solution269 ViewsLast Modified:
I have a VB.NET application that is using the FileSystemWatcher.  When a file (a video) is created (and ready) I want to move it to another folder.  However, the problem I'm having is that the FileSystemWatcher Created event fires when the 3rd party app (which does a conversion on a video) STARTS to write the new file, but not when it has completed.  So, when I try and move the file, obviously it's locked.

Is there anyway to tell when the file is no longer open by another process?  Is there anyway that the FileSystemWatch can handle this?

I know that I could grab the file, put it in a queue and with a timer, try and access it every so often, then when successful, I would know it's ready.  But this way just seems a little hokey.

Thanks in advance.
Wayne Taylor (webtubbs)

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros