maybe you could watch the change event also it has e.ChangeType = IO.WatcherChangeTypes.Crea
also sometimes apps - like notepad - fire the create event twice.
Main Topics
Browse All TopicsI 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.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
webtubbs,
I'm not very fond of the whole "goto" process, but your idea does solve the problem (buthogs all the system resources during the loop).
I ended up doing the following:
1) On File Creation, put file in an ArrayList, start a timer.
2) Time fires every second and tries to move the file and an App.DoEvents. If FileMove successful, removes file from the list.
3) If ArrayList is empty then stop the timer.
Simple enough, right?
I would have preferred to put this all in it's own class, but for some reason I couldn't get the timer to work the way I wanted it to (and call outside methods) without getting a Threading error. Oh well, it works.
Thanks for the help.
Business Accounts
Answer for Membership
by: webtubbsPosted on 2006-12-15 at 15:50:49ID: 18149925
You might be able to do it like this....
FileName, destFileName)
Start:
Try
System.IO.File.Move(source
Catch ex As Exception
GoTo Start
End Try
It's basically catching the exception, then trying again, and will continue diong so until the file is free.
Regards,
Wayne