Filesystemwatcher-- Realtime or not?

G

Guest

I am using the filesystemwatcher to track the movement of files from folder
to folder. I am tracking how long it takes for each file to get from point A
to point B. I have been able to do this, but would like to know if the
filesystemwatcher signals in realtime? I also noticed when the file activity
gets heavy the file system watcher does not signal for some files.

Thanks
 
M

Markus

I also noticed when the file activity gets heavy the file system
watcher does not signal for some files.

to your second concern of heavy file-changes, please read the
documentation of the FileSystemWatcher carefully (in the .NET Framework
documentation):

"The Windows operating system notifies your component of file changes in
a buffer the created by the FileSystemWatcher. If there are many changes
in a short time, the buffer can overflow. This causes the component to
lose track of changes in the directory, and it will only provide blanket
notification. Increasing the size of the buffer with the
InternalBufferSize property is expensive, as it comes from non-paged
memory that cannot be swapped out to disk, so keep the buffer as small
yet large enough to not miss any file change events. To avoid a buffer
overflow, use the NotifyFilter, and IncludeSubdirectories properties so
you can filter out unwanted change notifications."

hth
Markus
 
G

Guest

Thank you Markus. I will experiment with the buffer size, as I am already
using the NotifyFilter with a single filter, and have set
IncludeSubdirectories to false.
 

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