I'm copying from a client computer to a server computer in a shared directory. My server detects the new file, and after the copying is complete it has to process it. The problem is that, when writing a big file and using FileSystemWatcher
, you get no indication whether the copying is done or not. The only way to check this is by trying to open the file (File.OpenRead
/OpenWrite
) and getting an exception. How can I get a notification that the copy is complete without resorting to exception handling as flow control?
My first thought is if I could detect when the handle used for writing to the file is closed, I could tell exactly when the copying is complete, but I'm not sure how to do that.