M
Michael Stanbrook
I'm using the FileSystemWatcher to looks for new files
arriving in a directory. Files are coming in via FTP and
tend to be larger is size (> 1MB at least).
I would like to fire an event once the file is completely
written. I understand there is nothing "exactly" like
that due to how the OS filesystem works, so I am looking
for a workaround.
I am currently attempting to open the "new" file in
exclusing mode to "test" if the file is complete from
within the OnCreate and OnChange event handlers. If the
exclusive open is not successful, I sleep the thread, and
try again. Works like a charm, except I get multiple
Change events thrown, which causes my "test" to be
executed multiple times for each file.
Does anyone have a workaround for this? Perhaps a way to
block/ignore the change events after the first for a
given file?
TIA.
arriving in a directory. Files are coming in via FTP and
tend to be larger is size (> 1MB at least).
I would like to fire an event once the file is completely
written. I understand there is nothing "exactly" like
that due to how the OS filesystem works, so I am looking
for a workaround.
I am currently attempting to open the "new" file in
exclusing mode to "test" if the file is complete from
within the OnCreate and OnChange event handlers. If the
exclusive open is not successful, I sleep the thread, and
try again. Works like a charm, except I get multiple
Change events thrown, which causes my "test" to be
executed multiple times for each file.
Does anyone have a workaround for this? Perhaps a way to
block/ignore the change events after the first for a
given file?
TIA.