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?
views:
69answers:
2
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
2010-09-10 15:31:45
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
2010-09-10 15:34:28
So you just want to remove the system entries, not attribute them by user?
Steve Townsend
2010-09-10 15:36:58
Yes I just want to do that...
Barun
2010-09-10 15:40:32
+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
2010-09-10 15:33:40
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
2010-09-10 16:17:08