Tuesday, July 14, 2009

How can I monitor the saving of files to drive C?

What I need to do is write a program that monitors the saving of files to drive (C).


Then the program needs to write the filename to a file.


How can I monitor the file writes to drive (C)?


Note: This is for windows XP, and I need to program it in either Visual Basic.Net(preferred), C#.Net, or C++.Net.





Thanks in advance!!!!!

How can I monitor the saving of files to drive C?
Take a look at the FileSystemWatcher component. You can drag on onto the form, and it will raise events whenever any file change happens. In the event code you can find the name of the changed file and write that to your log file.





Note that if you try to use this on the whole C drive, it could slow down your system considerably. Consider just looking at the directory of interest.





-- In response to additional information --





Using filename filters is a good idea, and will probably prevent your system from slowing down too much. The best way to find out is to try it and see what kind of performance hit you take.





It sounds to me like you're going to watch all the extensions in the %COMSPEC% environment variable, and that list could get a little long.





BTW, have you checked out FileMon for Windows? It's a free download from Microsoft (SysInternals) and it might already do what you need. I'll link you...


No comments:

Post a Comment