you could try this:
Do While fi.length <> sz
System.Threading.Thread.Sleep(1000)
Loop

Signature
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net/home/listings.aspx
>I have a situation where I need to scan a folder for downloaded files and
> then process those files. I have a file system watcher which is looking
[quoted text clipped - 19 lines]
> (...and no, the sensible answer of getting the data provider to add the
> creation of a 0k control file at the end of the download isn't an option.)
Rob Oldfield - 06 Apr 2005 13:14 GMT
More efficient (and thanks for that), but still doesn't get around the
problem of it thinking that fi doesn't exist.
> you could try this:
>
[quoted text clipped - 25 lines]
> > (...and no, the sensible answer of getting the data provider to add the
> > creation of a 0k control file at the end of the download isn't an option.)
Chris Dunaway - 07 Apr 2005 22:25 GMT
What the FileSystemWatcher really needs is a FileClosed event! But
alas, we don't have that.
One technique similar to the one Rob specified is to attempt to open
the file exclusively. If that fails, it means the file is still in
use.
Do you control the downloading of the file? You could send the files
with a temporary name and then rename the file to its final name and
then have the FileSystemWatcher watch for the rename event.
Good Luck