D2,
Is the file being copied part of a controlled environment? In other
words, is the file being copied as the result of an operation from a client
which you have control over, or is it meant as a general file monitoring
system?
There was a system where I needed to process files once they were
dropped in a directory. I wanted to use the file system watcher, but I
couldn't know for sure when the writing of the file was complete. Because
we were in control of the client, we made it so that the client wrote a zero
byte marker file which would tell the FileSystemWatch er when to process the
original file. Since the marker file was zero bytes, one could reasonably
assume that the marker file and original file were both closed by the end of
processing.
Perhaps you could do something similar?
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard. caspershouse.co m
"D2" <dh*****@yahoo. comwrote in message
news:11******** *************@e 65g2000hsc.goog legroups.com...
Hi,
I have this problem when working with FileSystemWatch er class. I m
using one of these objects to watch over a folder. Whenever i big file
from another folder to the folder being watched, I get created event
and multiple changed events.
After the file is copied (fully) i want to read the file and perform
some operations on it. Now the issue is, there is no way to find that
the file has been copied entirely.
there are some workarounds like try to open file in a loop until u r
successful (this is the time when file got copied). This has a
potential problem, if I copy large number of files, it will skip about
50% of them .. depending on the size of files being copied.
Any better solutions?
Thanks,
D2