Monitoring Directories

R

rakesh_nits

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.
 
J

Jan Bannister

Hi rakesh,

The FileSystem watcher API in .NET is not designed for such high
traffic analysis. Your best bet is to use the Win32 Process and Handle
monitoring APIs to track what is going.

However, what ever it is your doing doesn't sound very wise as you'll
overload the OS with such fine grained analysis. If you want you track
file usage, use File System Autiding using SACLs.

Good Luck,
Jan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top