mustang_larry
asked on
.Net FileSystemWatcher Class copying large files- events.
c# .NET file system watcher class.
Using the file system class seems like a nice way to detect
when files appear in a folder.
When copying a large file the created event is fired right away.
What would be the best way to detect that file has been completely copied
before consuming the file for use.
here is a good example of the class.
http://www.codeguru.com/csharp/csharp/cs_network/article.php/c6043/
Using the file system class seems like a nice way to detect
when files appear in a folder.
When copying a large file the created event is fired right away.
What would be the best way to detect that file has been completely copied
before consuming the file for use.
here is a good example of the class.
http://www.codeguru.com/csharp/csharp/cs_network/article.php/c6043/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
When doing FTP, the common practice is to rename the file (with FTPrename) after the transfer is complete. Your consuming application looks for files with one extension while the transfer is done with a different extension, or, alternatively, you can rename the file between folders.
You may have to modify your file-producing application to rename the file after it is done creating it.
Regards,
Bill
You may have to modify your file-producing application to rename the file after it is done creating it.
Regards,
Bill
Try this:
System.Threading.Thread.Sl eep(<some value>)
before starting any operation on the file.
System.Threading.Thread.Sl
before starting any operation on the file.
another sollution:
I had similar problem, here is how I solved it..Chose time (in miliseconds, to delay action after watched event is fired)
Set code below under FileSystemWatcher1_Created , just before you want to do copying..
Me.FileSystemWatcher1.Wait ForChanged (IO.Watche rChangeTyp es.Created , 60000)
I had similar problem, here is how I solved it..Chose time (in miliseconds, to delay action after watched event is fired)
Set code below under FileSystemWatcher1_Created
Me.FileSystemWatcher1.Wait
Bob