473,396 Members | 2,115 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

filewatcher question

GS
I seem to get two file watcher changed invocation for a file change. I
thought may be the cause is third party software effect the change

I checked the general attributes of the files, it clearly shows the original
created date and new modified date time.. I also tried notepad on the file
and click File-save. I still get two invocation of the file changed event
so what gives. does that mean I would have to save the last modified date
time and size of the file I am watching to guard against the being invoked
twice for the same change?

if so, what would be the best approach to minimize to application if I
were to watch for say 40000 files in 10 folders?. there will be simple
filters and check for subfolders and files being ignored from a list

I guess I can get the file watcher change event to just queue up the file
spec, along creation date time, modified date time and let a worker thread
to do the grunt work of whatever needed to deal with the file changes.

Furthermore the file watcher changed event will do a quick look up if the
change belongs to the same change from early call and ignore the change..

do I need to be concerned about looking up in the queue for same change
when there are about 50 to 100 items in the queue?.

any reference to thread safe list or queue sharing? I am new to thread
safety.. I will also have to look up thread safe GUI as well
Dec 17 '07 #1
4 1392
On Dec 17, 10:34 am, "GS" <gsmsnews.microsoft.co...@msnews.Nomail.com>
wrote:
I seem to get two file watcher changed invocation for a file change. I
thought may be the cause is third party software effect the change

I checked the general attributes of the files, it clearly shows the original
created date and new modified date time.. I also tried notepad on the file
and click File-save. I still get two invocation of the file changed event

so what gives. does that mean I would have to save the last modified date
time and size of the file I am watching to guard against the being invoked
twice for the same change?

if so, what would be the best approach to minimize to application if I
were to watch for say 40000 files in 10 folders?. there will be simple
filters and check for subfolders and files being ignored from a list

I guess I can get the file watcher change event to just queue up the file
spec, along creation date time, modified date time and let a worker thread
to do the grunt work of whatever needed to deal with the file changes.

Furthermore the file watcher changed event will do a quick look up if the
change belongs to the same change from early call and ignore the change..

do I need to be concerned about looking up in the queue for same change
when there are about 50 to 100 items in the queue?.

any reference to thread safe list or queue sharing? I am new to thread
safety.. I will also have to look up thread safe GUI as well
With the multiple event fires, this seems relevant:

http://weblogs.asp.net/ashben/archiv.../14/31773.aspx
Dec 17 '07 #2
GS
thank you for the quick response. Looks like I should have a file watcher
per folder being watched and unfortunately the will consume about 40 to 80
KB or non paged memory
since I have to watch for files in subdirectories, I still need to leave the
IncludeSubdirectories turned on. Hence I need to distinguish directory
change from file change. right?

"sherifffruitfly" <sh*************@gmail.comwrote in message
news:b9**********************************@e6g2000p rf.googlegroups.com...
On Dec 17, 10:34 am, "GS" <gsmsnews.microsoft.co...@msnews.Nomail.com>
wrote:
I seem to get two file watcher changed invocation for a file change. I
thought may be the cause is third party software effect the change

I checked the general attributes of the files, it clearly shows the
original
created date and new modified date time.. I also tried notepad on the
file
and click File-save. I still get two invocation of the file changed
event

so what gives. does that mean I would have to save the last modified
date
time and size of the file I am watching to guard against the being
invoked
twice for the same change?

if so, what would be the best approach to minimize to application if I
were to watch for say 40000 files in 10 folders?. there will be simple
filters and check for subfolders and files being ignored from a list

I guess I can get the file watcher change event to just queue up the
file
spec, along creation date time, modified date time and let a worker
thread
to do the grunt work of whatever needed to deal with the file changes.

Furthermore the file watcher changed event will do a quick look up if
the
change belongs to the same change from early call and ignore the
change..

do I need to be concerned about looking up in the queue for same change
when there are about 50 to 100 items in the queue?.

any reference to thread safe list or queue sharing? I am new to thread
safety.. I will also have to look up thread safe GUI as well

With the multiple event fires, this seems relevant:

http://weblogs.asp.net/ashben/archiv.../14/31773.aspx

Dec 17 '07 #3
On Dec 17, 11:00 am, "GS" <gsmsnews.microsoft.co...@msnews.Nomail.com>
wrote:
thank you for the quick response. Looks like I should have a file watcher
per folder being watched and unfortunately the will consume about 40 to 80
KB or non paged memory

since I have to watch for files in subdirectories, I still need to leave the
IncludeSubdirectories turned on. Hence I need to distinguish directory
change from file change. right?
Sorry - I'm just learning how to use the class myself, and was just
sharing the results of googling for my own info. You'll have to get
someone more knowledgeable to answer those specific questions.

Offhand though, yes - it sounds like a good idea to distinguish dir
change from file change, if you're interested in that. I, for example,
only want to watch for new subdirectories being created off of a
particular directory.

Good luck!
Dec 17 '07 #4
GS
thank you very much for sharing. Did not find better info from Google. I
guess I will just have to try and find out.

"sherifffruitfly" <sh*************@gmail.comwrote in message
news:7b**********************************@b1g2000p ra.googlegroups.com...
On Dec 17, 11:00 am, "GS" <gsmsnews.microsoft.co...@msnews.Nomail.com>
wrote:
thank you for the quick response. Looks like I should have a file
watcher
per folder being watched and unfortunately the will consume about 40 to
80
KB or non paged memory

since I have to watch for files in subdirectories, I still need to leave
the
IncludeSubdirectories turned on. Hence I need to distinguish
directory
change from file change. right?

Sorry - I'm just learning how to use the class myself, and was just
sharing the results of googling for my own info. You'll have to get
someone more knowledgeable to answer those specific questions.

Offhand though, yes - it sounds like a good idea to distinguish dir
change from file change, if you're interested in that. I, for example,
only want to watch for new subdirectories being created off of a
particular directory.

Good luck!

Dec 17 '07 #5

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

Similar topics

4
by: Ron King Jr | last post by:
I have a small problem with my windows service. The first time I start the service everything works the way it's suppose to, but randomly the service fails. The jist of the service is to use the...
6
by: Troy Murphy | last post by:
The help file for Visual Studio .NET version 1 had a Walkthru for installing a Windows Service that would monitor a folder. Version 1.1 does not seem to have that example anymore. Could someone...
2
by: Roger Twomey | last post by:
I am working on a filewatcher application. The premis is: User uploads an xml file onto the web server the filewatcher app sees the xml file filewatcher app reads the file and inserts...
0
by: tshad | last post by:
I have a filewatcher program that is working syncronously (which is how I want it to work). But my program will handle whatever files are in the folder at the time it runs. So when I drop 15...
7
by: tshad | last post by:
What exactly is FileWatcher doing? When you drop 100 files in a folder it is watching, it normally will fire of the event 100 times. In my case, I do all my processing on the first event so I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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...
0
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...

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.