473,326 Members | 2,023 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,326 software developers and data experts.

Why is my FileSystemWatcher not working?.

Hi All,
I have a windows service that used a filesystemwatcher to monitor a directory, all worked fine. I am now trying to scale it to handle a few more watchers, depending on user input in a INI file.

The code i have the moment will read in the ini settings, and set the paths , it runs but the watchers never report I am trying this code below, but to no avail.

Any Ideas?. have I initialized them ok ?.

Also ClientFileUpdated just writes the event to eventviewer & filter set at ".*";


Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.         protected void CreateWatchers()
  4.         {
  5.             Logtext("Create Watchers");
  6.             ArrayList fw = new ArrayList();
  7.  
  8.  
  9.             foreach (string s in watchers)
  10.             {
  11.  
  12.                 MXFLOG.WriteEntry("For each loop");
  13.  
  14.                 FileSystemWatcher Clientwatcher = new FileSystemWatcher();
  15.  
  16.                 Clientwatcher.Path = s;
  17.  
  18.                 Clientwatcher.Filter = FileFilter;
  19.  
  20.                 Clientwatcher.NotifyFilter = NotifyFilters.LastWrite;
  21.  
  22.                 Clientwatcher.Created += new FileSystemEventHandler(ClientFileUpdated);
  23.  
  24.                 Clientwatcher.Changed += new FileSystemEventHandler(ClientFileUpdated);
  25.  
  26.                 Clientwatcher.EnableRaisingEvents = true;
  27.  
  28.                 fw.Add(Clientwatcher);
  29.  
  30.  
  31.                 } 
  32.             }
  33.  
Mar 21 '11 #1

✓ answered by philip Montgome

Working now , silly missing backslash in ini was not setting the path correctly. fixed now.

2 7560
Don't see why this is not working. Would it be better if I just initiate the watchers with a default dummy path and then change it so it reads the .INI file and change them?.

Any articles or pages on multiple filesystemwatchers would be great, have been looking all over but it seems not many people do this.
Mar 22 '11 #2
Working now , silly missing backslash in ini was not setting the path correctly. fixed now.
Mar 22 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jet Leung | last post by:
Hi all, I had made a program to watching files in my directory. I had used a instance of FileSystemWatcher to do my work.And I had add some events of the FileSystemWatcher , for example onChange,...
2
by: Steel City Phantom | last post by:
i am building a content distribution system using the filesystemwatcher to catch people moving files in and out of the system and update a database. what happens is when a process runs that moves...
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: 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
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...
2
by: kmcnet | last post by:
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...
2
by: Steve | last post by:
I have a FileSystemWatcher watching a directory where I will add and update files. When it detects a change, I search through all the files and update my list of files in the UI. This works fine....
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...
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...
5
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
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.