"Piotr Szukalski" <am*****@SPAM-AWAYpoczta.onet.pl> wrote in message
news:pa****************************@SPAM-AWAYpoczta.onet.pl...
Hi!
FileSystemWatcher raises 'Created' event immediately after the file has
been created - and what if someone transfers a very large file? Is there a
bether way to detect end of transmission than:
// --- wait for file transfer completed
while (! TryToOpenInExclusiveMode())
{
Sleep(someTime);
}
// --- file transfer completed
This is more or less how I've done it in the past. I create my own
FileSystemWatcher that mimicks the interface of the .Net one. The difference
being that I only fire the created event when I can get an exclusive lock.
There may be a better way, it's just never been a big enough problem before.
--
Regards,
Tim Haughton
Agitek
http://agitek.co.uk http://blogitek.com/timhaughton