directory watcher ?

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

    #1

    directory watcher ?

    ..2003 have a filesystemwatch er ...

    does it have a directorysystem watcher ? What i need is to watch whether
    directory is deleted ?

    i assume filesystemwatch er delete method is for file, not directory.

    Pls advise


  • Ken Tucker [MVP]

    #2
    Re: directory watcher ?

    Hi,

    The filesystemwatch will watch directories.

    http://msdn.microsoft.com/library/de...classtopic.asp

    Ken
    ------------------
    "James" <jkklim@hotmail .com> wrote in message
    news:OTqnbbIyFH A.1168@TK2MSFTN GP15.phx.gbl...[color=blue]
    > .2003 have a filesystemwatch er ...
    >
    > does it have a directorysystem watcher ? What i need is to watch whether
    > directory is deleted ?
    >
    > i assume filesystemwatch er delete method is for file, not directory.
    >
    > Pls advise
    >
    >[/color]


    Comment

    • James

      #3
      Re: directory watcher ?

      does it watch a directory being DELETED ?

      i thot filewatch only watch FILES within subdirectory.

      More concern is DIRECTORY itself being deleted.



      "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
      news:OB39vkIyFH A.2540@TK2MSFTN GP09.phx.gbl...[color=blue]
      > Hi,
      >
      > The filesystemwatch will watch directories.
      >
      >[/color]
      http://msdn.microsoft.com/library/de...classtopic.asp[color=blue]
      >
      > Ken
      > ------------------
      > "James" <jkklim@hotmail .com> wrote in message
      > news:OTqnbbIyFH A.1168@TK2MSFTN GP15.phx.gbl...[color=green]
      > > .2003 have a filesystemwatch er ...
      > >
      > > does it have a directorysystem watcher ? What i need is to watch whether
      > > directory is deleted ?
      > >
      > > i assume filesystemwatch er delete method is for file, not directory.
      > >
      > > Pls advise
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Ken Tucker [MVP]

        #4
        Re: directory watcher ?

        Hi,

        Watch the directories parent for the directory being delete.
        Simple example needs 2 buttons (btnDelete and btnAdd), a filesystemwatch er,
        and listbox.

        Imports System.IO


        Public Class Form1
        Inherits System.Windows. Forms.Form

        #Region " Windows Form Designer generated code "


        Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
        System.EventArg s) Handles MyBase.Load
        Directory.Creat eDirectory("C:\ Watch me")
        FileSystemWatch er1.Path = "C:\Watch me"
        FileSystemWatch er1.IncludeSubd irectories = True

        End Sub

        Private Sub FileSystemWatch er1_Created(ByV al sender As Object, ByVal e
        As System.IO.FileS ystemEventArgs) Handles FileSystemWatch er1.Created
        Dim strOut As String

        strOut = String.Format(" Created {0}", e.Name)
        ListBox1.Items. Add(strOut)
        End Sub

        Private Sub btnAdd_Click(By Val sender As System.Object, ByVal e As
        System.EventArg s) Handles btnAdd.Click
        Try
        Directory.Creat eDirectory("C:\ Watch me\Delete me")
        Catch ex As Exception

        End Try
        End Sub

        Private Sub btnDelete_Click (ByVal sender As System.Object, ByVal e As
        System.EventArg s) Handles btnDelete.Click
        Try
        Directory.Delet e("C:\Watch me\Delete me")
        Catch ex As Exception

        End Try
        End Sub

        Private Sub FileSystemWatch er1_Deleted(ByV al sender As Object, ByVal e
        As System.IO.FileS ystemEventArgs) Handles FileSystemWatch er1.Deleted
        Dim strOut As String

        strOut = String.Format(" Deleted {0}", e.Name)
        ListBox1.Items. Add(strOut)

        End Sub
        End Class


        Ken
        --------------------
        "James" <jkklim@hotmail .com> wrote in message
        news:uD3o9HJyFH A.2072@TK2MSFTN GP14.phx.gbl...[color=blue]
        > does it watch a directory being DELETED ?
        >
        > i thot filewatch only watch FILES within subdirectory.
        >
        > More concern is DIRECTORY itself being deleted.
        >
        >
        >
        > "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
        > news:OB39vkIyFH A.2540@TK2MSFTN GP09.phx.gbl...[color=green]
        >> Hi,
        >>
        >> The filesystemwatch will watch directories.
        >>
        >>[/color]
        > http://msdn.microsoft.com/library/de...classtopic.asp[color=green]
        >>
        >> Ken
        >> ------------------
        >> "James" <jkklim@hotmail .com> wrote in message
        >> news:OTqnbbIyFH A.1168@TK2MSFTN GP15.phx.gbl...[color=darkred]
        >> > .2003 have a filesystemwatch er ...
        >> >
        >> > does it have a directorysystem watcher ? What i need is to watch whether
        >> > directory is deleted ?
        >> >
        >> > i assume filesystemwatch er delete method is for file, not directory.
        >> >
        >> > Pls advise
        >> >
        >> >[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        Working...