Re: HELP! - FileSystemWatcher Problems
From: Frankie (JimM_at_nospam.com)
Date: 01/11/05
- Next message: Bob: "Remove specific datagrid tablestyle"
- Previous message: Bob Powell [MVP]: "Re: GDI Code Conversion"
- In reply to: kmcnet: "HELP! - FileSystemWatcher Problems"
- Next in thread: kmcnet: "Re: HELP! - FileSystemWatcher Problems"
- Reply: kmcnet: "Re: HELP! - FileSystemWatcher Problems"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 11 Jan 2005 06:07:14 -0600
kmcnet,
I had this problem, and the way that I worked around the problem was
creating two separate arraylists, one to monitor the events, the other was
used to process the items. When the event came in, I updated the arraylist
using the filename as the key. I used a timer to set a delay on the
processing and once things stabilized, just a few seconds, I moved my
"monitored" items into my queue and processed them. This may not be the best
way of doing things, actually, I don't really like the way I did it, but, it
worked. You may be able to tell if the file is finished by opening the file
exclusively, if you can then you know that something still has a handle on
it and suspend your processing. Remember to set the NotifyFilter property
to only those events you're interested in. hth
"kmcnet" <kmcnet@discussions.microsoft.com> wrote in message
news:A516C2F4-CF82-4DF3-97A5-852B08093288@microsoft.com...
> Hello Everyone and thanks for your help in advance. I have been battling
> a
> problem for nearly a month with the FileSystemWatcher component.
> Basically,
> what I am trying to do it to monitor three separate folders on a Windows
> 2000
> server for activity. In my code, I have set up three separate
> subroutines:
>
> FaxWatch()
> ReportWatch()
> ScheduleWatch()
>
> Each of the subroutines creates a new instance of the FileSystemWatcher.
> However, I am running into a number of issues. First and most problematic
> is
> that when I create two instances of the component, it seems to work, but a
> third one stops all monitoring entirely (for example, calling the
> ScheduleWatch() routine). Additionally, some of the files written to the
> directory are somewhat large, and I need to figure out a way to wait for
> the
> file to be completely written before taking action. I have tried
> LastWrite
> and LastModified filters, but they don't seem to completely solve the
> problem. Finally, there is the documented issue of multiple events being
> fired from one event, but I think I can work around this issue if I can
> get
> the rest working properly. The FileSystemWatcher really looks like a
> useful
> tool, but only if it works correctly. Any help on this issue is greatly
> appreciated. Thanks.
- Next message: Bob: "Remove specific datagrid tablestyle"
- Previous message: Bob Powell [MVP]: "Re: GDI Code Conversion"
- In reply to: kmcnet: "HELP! - FileSystemWatcher Problems"
- Next in thread: kmcnet: "Re: HELP! - FileSystemWatcher Problems"
- Reply: kmcnet: "Re: HELP! - FileSystemWatcher Problems"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|