Monitor files accessed by other programs
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 fi开发者_StackOverflownd anything similar enough.)
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.
精彩评论