monitoring directories
-
Hi All, I want to watch all fixed drives on a computer.Is there any reliable way to do that.I am watching for create , delete , change , rename events for all files and folders.I am using filesystemwatcher but its not very reliable at all especially for high trafiic activity.I am using empty string for the filter property.I have changed internalbuffersize to 32 KB.I don't want to miss any event , if any event fires two or three times that is not a problem.I in the notifyfilters i have set that property to NotifyFilters.Size|NotifyFilters.LastAccess|NotifyFilters.LastWrite|NotifyFilters.FileName|NotifyFilters.DirectoryName|NotifyFilters.CreationTime|NotifyFilters.Attributes even after that i am having troubles with word documents especially when i write into a word document and save it sometimes it fires changed event and sometimes i am not able to get the event .it is not showing the internal buferoverflow exception on that time either.and when i am copying a large directory say having around 13000 files then internal buffer overflow exception occurs.on msdn site they have given that with a 4 KB buffer size we can watch change for around 80 files so may be i have to use very large buffer size.Is there any other Class or Win32 API available which can do the task so that I must be able to watch all the events and don't miss any event.Thanks in Advance.
-
Hi All, I want to watch all fixed drives on a computer.Is there any reliable way to do that.I am watching for create , delete , change , rename events for all files and folders.I am using filesystemwatcher but its not very reliable at all especially for high trafiic activity.I am using empty string for the filter property.I have changed internalbuffersize to 32 KB.I don't want to miss any event , if any event fires two or three times that is not a problem.I in the notifyfilters i have set that property to NotifyFilters.Size|NotifyFilters.LastAccess|NotifyFilters.LastWrite|NotifyFilters.FileName|NotifyFilters.DirectoryName|NotifyFilters.CreationTime|NotifyFilters.Attributes even after that i am having troubles with word documents especially when i write into a word document and save it sometimes it fires changed event and sometimes i am not able to get the event .it is not showing the internal buferoverflow exception on that time either.and when i am copying a large directory say having around 13000 files then internal buffer overflow exception occurs.on msdn site they have given that with a 4 KB buffer size we can watch change for around 80 files so may be i have to use very large buffer size.Is there any other Class or Win32 API available which can do the task so that I must be able to watch all the events and don't miss any event.Thanks in Advance.
Without writing your monitoring code as an NTFS extension, no there is no reliable method to capture changes acrossed an entire volume. FileMon, from SysInternals, uses this technique. It requires a black belt in NTFS internals and Interop to implement though. The FileSystemWatcher relys on the NT Kernel function
ReadDirectoryChangesW
. This function is known to have more than a few problems, especially when monitoring remote directories. The problems just get worse, the bigger the directory tree you're monitoring. For more information, search forReadDirectoryChangesW
on MSDN. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome