0

I am coding a module in C#. I need help in a case wherein...

There is a directory in which there are text files being written. Once this process is done, there would be no further changes being made in the directory. How do I know that the process of writing files in the directory has being completed?

Aakanksha Choudhary
  • 515
  • 2
  • 5
  • 19
  • FileSystemWatcher; https://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(v=vs.110).aspx – bic Jun 18 '17 at 21:42
  • Possible duplicate of [FileSystemWatcher - is File ready to use](https://stackoverflow.com/questions/12268067/filesystemwatcher-is-file-ready-to-use) – TomServo Jun 18 '17 at 21:48
  • If you design whole system just don't do this instead do some kind of communication that will tell when another process done it's work. Easiest approach for ex. may be creation of empty file with predefined name or move folder to another folder etc. – Logman Jun 18 '17 at 22:42

1 Answers1

0

Use the FileSystemWatcher class to monitor a directory https://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(v=vs.110).aspx

bic
  • 2,201
  • 26
  • 27