2

I'm looking for a way to monitor (and read) files that are created or accessed by another program. I found an approach in this article. However, this article uses a C++ solution that is embedded in a C# program.

Is there a native C# solution for this monitoring job?

(Sorry if this has been asked before. I just couldn't find anything similar enough.)

RolandK
  • 490
  • 5
  • 15

1 Answers1

5

You should probably look into FileSystemWatcher class. I haven't used it yet, but seems that this sort of thing is what it is for:

Use FileSystemWatcher to watch for changes in a specified directory. You can watch for changes in files and subdirectories of the specified directory. You can create a component to watch files on a local computer, a network drive, or a remote computer.

IAbstract
  • 19,551
  • 15
  • 98
  • 146