7

I want to develop the application which logs the files / directories accessed on the machine.

e.g. I go to D:\ and into a folder documents and open a word file. I want my application to create a log in the following format:

  1. D:\ Opened
  2. D:\documents Opened
  3. D:\documents\secret.docx Opened

I've used FileSystemWatcher to achieve the other type of file system activity but unable to get events for accessing this.

Daniel Hilgarth
  • 171,043
  • 40
  • 335
  • 443
Balwant Singh
  • 287
  • 5
  • 14

3 Answers3

3

sounds like you wanna do a FileMon program like sys internals. in their website Mark tells about the way FileMon works so you can get some inspiration by reading the article.

also see here: How do you monitor file access and changes on a file server by user name?

Community
  • 1
  • 1
Davide Piras
  • 43,984
  • 10
  • 98
  • 147
1

Not sure this sort of monitoring can be achieved with filesystemwatcher as it is aimed at monitoring changes I believe. You could use filesystem Auditing (by going into advanced security settings) which will log events in eventlog and you can pull it from there.

Maverik
  • 5,619
  • 35
  • 48
0

Most viable option is use of file system filter driver. Such driver gives you fine-grain control over all requests going to particular file system. The only issue with this approach is complexity of developing such driver in kernel mode.

Eugene Mayevski 'Callback
  • 45,135
  • 8
  • 71
  • 121