473,509 Members | 3,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FileSystemWatcher questions

I'm confused between FileSystemWatcher events (Changed, Created, Deleted,
Renamed) and the NotifyFilter. It seems that they are redundant and even
inconsistent at the same time.

For example, if I subscribe to the "Changed" event, and use a NotifyFilter
of "LastWrite", aren't they specifying the same thing?

Another example, if I subscribe only to the "Deleted" event, and use
NotifyFilter of "Size", what would that do?

Thanks for any clarification.
--Marty
Jul 21 '05 #1
4 1423
Hello Marty,

Thanks for your post. I'd like to share the following information with you:
For example, if I subscribe to the "Changed" event, and use a NotifyFilter of "LastWrite", aren't they specifying the same thing?

According to MSDN documentation, the "Changed" event may be triggered when
the size, attributes, security settings, last write, and last access time
are changed. With NotifyFilter set to LastWrite, it will go to your Changed
event handler only when last write change occurs. Please refer to MSDN
documentation for detailed information:

WatcherChangeTypes Enumeration
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemiowatcherchangetypesclasstopic.asp

NotifyFilters Enumeration
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemionotifyfiltersclasstopic.asp
Another example, if I subscribe only to the "Deleted" event, and use

NotifyFilter of "Size", what would that do?

"Deleted" event will be triggered when a file or folder is deleted.
NotifyFilter of "Size" does not take effect, because "Changed" event is not
specified.

Does this answer your questions?

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #2
Hello Marty,

Thanks for your post. I'd like to share the following information with you:
For example, if I subscribe to the "Changed" event, and use a NotifyFilter of "LastWrite", aren't they specifying the same thing?

According to MSDN documentation, the "Changed" event may be triggered when
the size, attributes, security settings, last write, and last access time
are changed. With NotifyFilter set to LastWrite, it will go to your Changed
event handler only when last write change occurs. Please refer to MSDN
documentation for detailed information:

WatcherChangeTypes Enumeration
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemiowatcherchangetypesclasstopic.asp

NotifyFilters Enumeration
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemionotifyfiltersclasstopic.asp
Another example, if I subscribe only to the "Deleted" event, and use

NotifyFilter of "Size", what would that do?

"Deleted" event will be triggered when a file or folder is deleted.
NotifyFilter of "Size" does not take effect, because "Changed" event is not
specified.

Does this answer your questions?

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #3
Tian,
Your post does answer my question. It is clear now! Thanks for the
information.
--Marty
Jul 21 '05 #4
Tian,
Your post does answer my question. It is clear now! Thanks for the
information.
--Marty
Jul 21 '05 #5

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

Similar topics

7
4181
by: John Bailo | last post by:
I've posted parts of problems in other posts, but I thought I'd consolidate my questions because I still don't have a solution. Problem: I want to use the creation of a file on a remote ftp...
1
3305
by: Troy Murphy | last post by:
How do I prevent the FileSystemWatcher event to keep firing while the file is being created? When copying a file to the watched folder, the event fires a dozen or more times! Also, the...
13
9115
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
14224
by: Stampede | last post by:
Hi, I want to use the FileSystemWatcher in a Windows Service. I read an article, where the author created the FileSystemWatcher object in a seperate thread and when the event is fired, he started...
20
4415
by: J-T | last post by:
We are working on an asp.net application which is a 3-tier application.I was aksed to create a component which monitors a folder and gets the file and pass them to a class library in our business...
1
848
by: Mike Fegter | last post by:
I am a bit confused. I am using a 3rd party COM object that adds records to a SQL DB through OLE (that's what they use). I can get this working perfectly in .NET. Now, when I add the...
12
7417
by: ljh | last post by:
Has anyone else noticed that the FileSystemWatcher raises the changed event twice when a file is changed? Do you have any idea why this is the case?
15
4741
by: Angelo | last post by:
Hi all, I'm using a FileSystemWatcher to monitor a directory. I want the FSW to pop up my already instantiated but invisible form. However, I'm running into some problems with this. 1) In...
5
5551
by: =?Utf-8?B?Sm9obiBT?= | last post by:
I am trying to find out if there is a way to tell if there is already a filesystemwatcher (created by a webservice) monitoring a folder. I have a webservice that creates a filesystemwatcher,...
0
7136
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
7344
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7069
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
7505
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
5652
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4730
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3203
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1570
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
441
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.