R
Rob Oldfield
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 for
the creation of a file but clearly I want wait until the file is completely
downloaded before I start trying to use it. At present I'm trying this...
Dim fi As New FileInfo(fle)
'Don't try to read while still being written
Do While fi.Length <> sz
s = TimeOfDay.Second
Do While TimeOfDay.Second = s
Loop
sz = fi.Length
Loop
....but that's going wrong on the sz=fi.length line (not immediately, but
intermittently)... telling me that the file doesn't exist.
Does anyone have a better way of approaching this?
(...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.)
then process those files. I have a file system watcher which is looking for
the creation of a file but clearly I want wait until the file is completely
downloaded before I start trying to use it. At present I'm trying this...
Dim fi As New FileInfo(fle)
'Don't try to read while still being written
Do While fi.Length <> sz
s = TimeOfDay.Second
Do While TimeOfDay.Second = s
Loop
sz = fi.Length
Loop
....but that's going wrong on the sz=fi.length line (not immediately, but
intermittently)... telling me that the file doesn't exist.
Does anyone have a better way of approaching this?
(...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.)