FileSystemWatcher

  • Thread starter Thread starter Matthew Clay
  • Start date Start date
M

Matthew Clay

Does anyone know if the FileWatcher will wait for complete
delivery of a file? This is in response to an FTP command
that sends an 80mb file, which consequently is never
locked but obviously takes some time to complete being
sent to the file system.

Matt
 
The FileSystemWatcher does not wait.
And if the ftp service opens, appends, closes for every received chunck of
data, you will receive a lot of 'changed' events from the filesystemwatcher.

Peter
 
Matthew Clay said:
Does anyone know if the FileWatcher will wait for complete
delivery of a file? This is in response to an FTP command
that sends an 80mb file, which consequently is never
locked but obviously takes some time to complete being
sent to the file system.


You say the file is never locked, but I doubt it. The FTP server should
keep the file open until the transfer is done.

Try to open the file with IO.FileShare.None. If the file is open, it will
fail.

Dim fs As New IO.FileStream("file.ext", IO.FileMode.Open,
IO.FileAccess.ReadWrite, IO.FileShare.None)

David
 
Back
Top