By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,826 Members | 2,443 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,826 IT Pros & Developers. It's quick & easy.

Help: FileSystemWatcher weird problem!

P: n/a

I have some weird problem with the FileSystemWatcher. I have developed
an application that monitors a network directory for file changes of a
certain file type. The program runs well for a week. Then suddenly the
monitored network server starts to behave crazily. It sends to my Sync
Server dozens of replicated file change events. Say one file was
changed two days ago, but the monitored server still keeps sending me
many many events of that file. It sends me 9000 events in a minutes
and keeps sending me so many events hour by hour. This drives me
crazy!! Our network server is a Windows 2000 Server. It's a important
server that many people here need to access it and modify files on the
monitored directory.

Why that network server keeps sending me false 'file change' event? Is
that some kind of worm? What windows service does FileSystemWatcher
events rely on? I have check the event log, but it doesn't help much.
Please help! THANKS.

Here is some code in my application. I don't think my code have some
problem, because the server can run for serveral days without any
problem. The problem is my sync server got toooo many false events!!

watcher.Path = srcdir; // monitored network directory
watcher.Filter=filetype; //certain file type such as"*.doc"
watcher.IncludeSubdirectories = true;
watcher.NotifyFilter =
NotifyFilters.FileName|NotifyFilters.LastWrite|Not ifyFilters.DirectoryName|NotifyFilters.Size;

// Setup event handlers
watcher.Changed += new FileSystemEventHandler(OnChanged);
watcher.Created += new FileSystemEventHandler(OnChanged);
watcher.Deleted += new FileSystemEventHandler(OnDeleted);
watcher.Renamed += new RenamedEventHandler(OnRenamed);
watcher.Error += new ErrorEventHandler(OnError);

// Enable the FileSystemWatcher to notify events
watcher.EnableRaisingEvents = true;
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.