A
Andreas
Hi,
we have some problems with the following situation:
A remote application A writes files to a directory monitored by a
FileSystemWatcher-instance in application B. A creates the file
with the initial ending "COPY_IN_PROGRESS" and only after
successful copying the file gets renamed to its final ending
"TO_DO". The FileSystemWatcher of B is set to react on the
rename-event and upon recognizing an event some processing
is triggered.
Now the problem is that obviously the event is raised and also
recognized, however the renamed file seems to not yet exist
within the filesystem: the given RenamedEventArgs contain the
new filename, however a File.Exists on this filename, executed
first within the OnEvent-method, returns with false.
Though, if some trace messages are inserted before the File.Exists
everything is working fine, so it seems that there might be some
sort of timing problem. Is it possible that the rename event is
raised before completion of the file system update.
Does anyone know something about this problem or has a solution
ready? (inserting some delay wouldn't be a proper solution; a
completely event-driven solution is preferred)
Thanks in advance
Andreas
we have some problems with the following situation:
A remote application A writes files to a directory monitored by a
FileSystemWatcher-instance in application B. A creates the file
with the initial ending "COPY_IN_PROGRESS" and only after
successful copying the file gets renamed to its final ending
"TO_DO". The FileSystemWatcher of B is set to react on the
rename-event and upon recognizing an event some processing
is triggered.
Now the problem is that obviously the event is raised and also
recognized, however the renamed file seems to not yet exist
within the filesystem: the given RenamedEventArgs contain the
new filename, however a File.Exists on this filename, executed
first within the OnEvent-method, returns with false.
Though, if some trace messages are inserted before the File.Exists
everything is working fine, so it seems that there might be some
sort of timing problem. Is it possible that the rename event is
raised before completion of the file system update.
Does anyone know something about this problem or has a solution
ready? (inserting some delay wouldn't be a proper solution; a
completely event-driven solution is preferred)
Thanks in advance
Andreas