filewatcher question

G

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
 
S

sherifffruitfly

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/archive/2003/10/14/31773.aspx
 
G

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?
 
S

sherifffruitfly

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!
 
G

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.
 

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

Similar Threads


Top