views:

58

answers:

2

I want to use performance monitors to determine when a file is being accessed (read/write). Is this possible? If not, is there any other way? My OS is Windows Server 2008 R2, and I am writing the code in C#.

+1  A: 

For what its worth, you can use FileSystemWatcher to monitor writes to a specific file.

Justin Ethier
A: 

Unfortunately I don't think there is an API available for doing this using managed code. If you need to hook a file system read or write event, you should look into writing a filter driver. Filter drivers are pretty low-level constructs and if it's only to do performance monitoring then it's probably not worth it. This API is often utilized by anti-virus or backup/replication software developers.

BigZig