C# FileSystemWatcher with multi path

  • Thread starter Thread starter eyal
  • Start date Start date
E

eyal

Hi,

I need to detect changes on several directory at the same time.

for example: D:\temp c:\docs and so on.
the problem is that this component have 1 'Path' in it's attribute.
how can i solve this problem?

i'm using C# ( and i'm new to this language )

Please help.
 
Eyal,

In order to get around this, you have to have multiple instances of the
FileSystemWatcher class, each pointing to a different path to watch.

Hope this helps.
 
eyal said:
I need to detect changes on several directory at the same time.

for example: D:\temp c:\docs and so on.
the problem is that this component have 1 'Path' in it's attribute.
how can i solve this problem?

Use a distinct instance of FileSystemWatcher for each directory (unless you
have to watch all subdirs of a given directory; in this case you can use a
single FileSystemWatcher).
 
Hi,

You have to use one instance for each directory.
What you can do is use the same method to handle the events from ALL the
instances.

Cheers,
 
Thanks a lot.


Ignacio Machin \( .NET/ C# MVP \) said:
Hi,

You have to use one instance for each directory.
What you can do is use the same method to handle the events from ALL the
instances.

Cheers,
 
Back
Top