Skip to content

Monitoring files

Marius Pol

Asked Nov 7, 2005, 2:20 PM EST2 answers
Share
LinkedInX
Hi, I have to monitor a folder for new files. I use System.IO.FileSystemWatcher to do that. The problem is that the files are downloading over there and I have to find out when they are completely downloaded. The System.IO.FileSystemWatcher fires an event when the file is first created and 2 others, of the same type after that. But I can't get the moment when the files are completely downloaded. If you have any idea... Mircea.

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Hello, well I'm assuming that you are either working with a web app, or a Console App...in either cases your program is not going to run the whole time (only when the event gets triggered, which is in your case when the file gets created). What you need here is to be able to run the executible the whole time while the files are being downloaded.  In order to accomplish that I think you should use windows services in .Net. Hope this will help.
    0
  • 0
    Hi,
      It is not possible to find out whether the file has been completely downloaded or not. A workaround for this would be to drop another file (eg..with a different custom extension - .myext ) and trigger the event of the file drop. Then we can find out that the earlier file is completed. The latest triggered event can delete the custom file and do necessary operations on the appropriate downloaded file.
    0