views:

69

answers:

2

I am using FileSystemWatcher for tracking file system for any changes. But my customer does not want any system file change records. He just wants "changed by user" records. How can I do this?

A: 

I don't believe there's any way to do this in Win32 or .Net framework. You'd have to intercept file access in the kernel to provide such a service.

Steve Townsend
Yes I am doing it. It is working perfectly. But one problem is I cant filter it or there is a way which I dont know.
Barun
So you just want to remove the system entries, not attribute them by user?
Steve Townsend
Yes I just want to do that...
Barun
+1  A: 

Subscribe for the FileSystemWatcher.Changed event and filter the files manually:

MyFolderWatcher.Changed += (s, e) => {
    if ((File.GetAttributes(e.FullPath) & FileAttributes.System) != FileAttributes.System)
        ; // Do something
}
BlueCode
But What about deleted file folder ??
Barun
When you get the changed event, check the path isn't the recycle bin. If it is ignore it, else do whatever you're interested in. To get the name of the recycle folder look at http://stackoverflow.com/questions/936397/finding-the-recycle-bin-on-a-local-ntfs-drive
JLWarlow