FileSystemWatcher

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • raghu

    FileSystemWatcher

    Hi All
    Anyone help me to set multiple drives for FileSystemWatch er component.

    FileSystemWatch er watcher=new FileSystemWatch er();
    watcher.Path = "c:\"

    this is working fine.

    If i give
    watcher.Path = "c:\,d:\"

    its throwing exception. Is there anyway to achive this?

    thanks in advance
    Raghu.

  • Justin Rogers

    #2
    Re: FileSystemWatch er

    Set up multiple watchers, but have them all event to the same callback.


    --
    Justin Rogers
    DigiTec Web Consultants, LLC.
    Blog: http://weblogs.asp.net/justin_rogers

    "raghu" <tb.sriraghuraj a@digital.com> wrote in message
    news:D940FED0-B48C-45A3-BF2D-E902D1553041@mi crosoft.com...[color=blue]
    > Hi All
    > Anyone help me to set multiple drives for FileSystemWatch er component.
    >
    > FileSystemWatch er watcher=new FileSystemWatch er();
    > watcher.Path = "c:\"
    >
    > this is working fine.
    >
    > If i give
    > watcher.Path = "c:\,d:\"
    >
    > its throwing exception. Is there anyway to achive this?
    >
    > thanks in advance
    > Raghu.
    >[/color]


    Comment

    • raghu

      #3
      Re: FileSystemWatch er

      Hi Roger
      thanks for your reply. But this solution is not the right for me. Incase if my client has 10 Drives i cannot ask him to create 10 different watchers.
      Cannot we setup multiple drives with Path property

      Regard
      Raghu

      Comment

      • Gaurav Khanna [C# MVP]

        #4
        Re: FileSystemWatch er

        Hi!

        FSW is used to watch and monitor for changes, only one folder (eg. C:\, D:\,
        etc). Create multiple watchers for multiple drives.

        --
        Regards,
        Kumar Gaurav Khanna
        -----------------------------------------------------------------
        Microsoft MVP - C#/.NET, MCSE Windows 2000/NT4, MCP+I
        WinToolZone - Spelunking Microsoft Technologies

        OpSupport - Spelunking Rotor

        Bangalore .NET Users' Group

        "raghu" <tb.sriraghuraj a@digital.com> wrote in message
        news:D940FED0-B48C-45A3-BF2D-E902D1553041@mi crosoft.com...[color=blue]
        > Hi All
        > Anyone help me to set multiple drives for FileSystemWatch er component.
        >
        > FileSystemWatch er watcher=new FileSystemWatch er();
        > watcher.Path = "c:\"
        >
        > this is working fine.
        >
        > If i give
        > watcher.Path = "c:\,d:\"
        >
        > its throwing exception. Is there anyway to achive this?
        >
        > thanks in advance
        > Raghu.
        >[/color]


        Comment

        • Gaurav Khanna [C# MVP]

          #5
          Re: FileSystemWatch er

          Hi Raghu!

          The watcher is based upon the FindFirstChange Notification Win32 API, and
          that itself allows to monitor only a single folder and its subtree. Thus,
          you will need a seperate watcher for each root drive folder.

          --
          Regards,
          Kumar Gaurav Khanna
          -----------------------------------------------------------------
          Microsoft MVP - C#/.NET, MCSE Windows 2000/NT4, MCP+I
          WinToolZone - Spelunking Microsoft Technologies

          OpSupport - Spelunking Rotor

          Bangalore .NET Users' Group

          "raghu" <anonymous@disc ussions.microso ft.com> wrote in message
          news:659E7EB1-5E6F-46EE-9BE2-643672571D94@mi crosoft.com...[color=blue]
          > Hi Rogers
          > thanks for your reply. But this solution is not the right for me. Incase[/color]
          if my client has 10 Drives i cannot ask him to create 10 different watchers.[color=blue]
          > Cannot we setup multiple drives with Path property?
          >
          > Regards
          > Raghu[/color]


          Comment

          Working...