473,472 Members | 1,728 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

FileSystemWatcher.NotifyFilter mystery

..Net 2.0 in VB
Watcher = New FileSystemWatcher()
AddHandler Watcher.Changed, New FileSystemEventHandler(AddressOf
Watcher_Changed)
AddHandler Watcher.Created, New FileSystemEventHandler(AddressOf
Watcher_Created)
AddHandler Watcher.Deleted, New FileSystemEventHandler(AddressOf
Watcher_Deleted)
AddHandler Watcher.Renamed, New RenamedEventHandler(AddressOf Watcher_Renamed)
AddHandler Watcher.Error, New ErrorEventHandler(AddressOf Watcher_Error)
' Watcher.NotifyFilter = NotifyFilters.Attributes Or NotifyFilters.Security

Watcher.Path = WatchDir.Text
Watcher.Filter = WatchMask.Text
Watcher.EnableRaisingEvents = True

This code works fine for me.
However, if I uncomment the NotifyFilter statement, the create and delete
handlers are never triggered. The rename handler is not triggered either, but
if I rename a file, it shows up in the change handler. If I change a text
file, say I load it in notepad and save it, the change handler triggers, even
though neither the security not attributres changed. Nothing changed, not
even the size, other than the access date. Yet the handler triggered, though
the filter supposedly limits what changes it looks for.

What went wrong?

Thanks,
Jon
Apr 25 '07 #1
0 2974

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: eyal | last post by:
Hi, I'm trying to do this: private void SetNF(FileSystemWatcher fsw,int val){ if( (val&4)!=0 ) fsw.NotifyFilter |= System.IO.NotifyFilters.Attributes; // i'v tried this also: // if(...
5
by: Jon Maz | last post by:
Hi there, I am experimenting with the FileSystemWatcher object. I have set the NotifyFilter as follows: myFileSystemWatcher.NotifyFilter = NotifyFilters.Security | NotifyFilters.CreationTime...
13
by: David | last post by:
I have been working on trying to write a directory watcher service. One of the requirments is that it be able to watch multiple directories, not sub directories of one parent directory, but just...
3
by: Peter Kirk | last post by:
Hi I am trying to use FileSystemWatcher to watch for changes in a directory. The problem I am exepriencing is a double firing of an OnChanged event when a file is opened, edited, and saved. Why...
1
by: Terry Olsen | last post by:
I have a console app that uses FileSystemWatcher to watch for a certain file to be created, then it reads the data out of the file, inserts it into an sql database, deletes the file and then...
7
by: Frank | last post by:
Hi, I am using FileSystemWatcher to track the change in a text file. Whenever I run the program I get 99% CPU utilization. The code doesn't do anything just sits and waits in a while loop until...
5
by: Goran Djuranovic | last post by:
Hi all, I have a file system watcher service that works fine on a local hard drive, but will not work across the network. I tried both: mapping the drive and "\\..." path both no luck. I don't...
4
by: hooksie2 | last post by:
Hi, I am trying to use FileSystemWatcher to watch a log file which is written to via a 3rd party app and display the log in listbox on a form. The FileSystemWatch seems to work okay but I get...
3
by: =?Utf-8?B?RGFuaWVs?= | last post by:
I'm working with the FileSystemWatcher which has a Created event. But this event is raised as soon as the new file begins to be written on disk. What I want is a notification after a file being...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.