FileSystemWatcher events being reported when non should be

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

    FileSystemWatcher events being reported when non should be

    I have just started using the FileSystemWatch er in VB.NET. My first attempt
    was to connect to a share, using unc paths, to a server running Win2000.
    Everything was working great for about two days. Today, at about 6:30am
    pst, the program stopped working. At first I thought it was the program, so
    I put in some console.writeli ne statements to track the progress of the
    program. What I found out appears to not be a problem with my program but
    rather the server. As soon as my program starts and turns
    ..EnableRaising Events to true, it starts reporting files as being changed
    which were in fact not changed. When I cancel the program and restart it,
    it starts where it left off. It appears, for some reason, that the server
    has queued these messages and is continuing to report the events.

    Has anyone had this same problem? Does anyone know what I can do to keep
    this from happening, or know why it happened in the first place? My first
    thought was that the server drives were restored, but this is not the case.

    Any help would be greatly appreciated.

    fsw.Path = fPath 'fPath = "\\public1\data \html"
    fsw.IncludeSubd irectories = True
    fsw.EnableRaisi ngEvents = True
    fsw.NotifyFilte r = fsw.NotifyFilte r Or NotifyFilters.F ileName Or
    NotifyFilters.L astWrite Or NotifyFilters.S ize

    Private Sub fsw_All(ByVal sender As Object, ByVal e As FileSystemEvent Args)
    Handles fsw.Created, fsw.Changed, fsw.Deleted
    Dim changeType As String = [Enum].GetName(GetTyp e(WatcherChange Types),
    e.ChangeType)
    Try
    If changeType.ToLo wer = "deleted" Then
    fl.log(e.FullPa th & "||" & changeType & "|" & Now())
    Else
    If Not CBool(File.GetA ttributes(e.Ful lPath) And FileAttributes. Directory)
    Then
    fl.log(e.FullPa th & "||" & changeType & "|" & Now())
    End If
    End If
    Catch
    End Try
    End Sub

    Private Sub fsw_renamed(ByV al sender As Object, ByVal e As RenamedEventArg s)
    Handles fsw.Renamed
    'If Not CBool(File.GetA ttributes(e.Ful lPath) And FileAttributes. Directory)
    Then
    fl.log(e.OldFul lPath & "|" & e.FullPath & "|renamed" & "|" & Now())
    'End If
    End Sub


  • Glenn

    #2
    Re: FileSystemWatch er events being reported when non should be

    I found out a bit more information. It turns out that Norton AntiVirus was
    performing a scan, but I am not sure if the scan was going on during the
    time I noticed the problem. I am still wondering what type of change was
    being done by the scan that would cause an event to be reported and what the
    event was? Is there something that I can do to ignore those events or know
    what process caused the event?

    "Glenn" <glennt00-newsgroupRemove @yahoo.com> wrote in message
    news:%23qJTscow DHA.3216@TK2MSF TNGP11.phx.gbl. ..[color=blue]
    > I have just started using the FileSystemWatch er in VB.NET. My first[/color]
    attempt[color=blue]
    > was to connect to a share, using unc paths, to a server running Win2000.
    > Everything was working great for about two days. Today, at about 6:30am
    > pst, the program stopped working. At first I thought it was the program,[/color]
    so[color=blue]
    > I put in some console.writeli ne statements to track the progress of the
    > program. What I found out appears to not be a problem with my program but
    > rather the server. As soon as my program starts and turns
    > .EnableRaisingE vents to true, it starts reporting files as being changed
    > which were in fact not changed. When I cancel the program and restart it,
    > it starts where it left off. It appears, for some reason, that the server
    > has queued these messages and is continuing to report the events.
    >
    > Has anyone had this same problem? Does anyone know what I can do to keep
    > this from happening, or know why it happened in the first place? My first
    > thought was that the server drives were restored, but this is not the[/color]
    case.[color=blue]
    >
    > Any help would be greatly appreciated.
    >
    > fsw.Path = fPath 'fPath = "\\public1\data \html"
    > fsw.IncludeSubd irectories = True
    > fsw.EnableRaisi ngEvents = True
    > fsw.NotifyFilte r = fsw.NotifyFilte r Or NotifyFilters.F ileName Or
    > NotifyFilters.L astWrite Or NotifyFilters.S ize
    >
    > Private Sub fsw_All(ByVal sender As Object, ByVal e As[/color]
    FileSystemEvent Args)[color=blue]
    > Handles fsw.Created, fsw.Changed, fsw.Deleted
    > Dim changeType As String = [Enum].GetName(GetTyp e(WatcherChange Types),
    > e.ChangeType)
    > Try
    > If changeType.ToLo wer = "deleted" Then
    > fl.log(e.FullPa th & "||" & changeType & "|" & Now())
    > Else
    > If Not CBool(File.GetA ttributes(e.Ful lPath) And FileAttributes. Directory)
    > Then
    > fl.log(e.FullPa th & "||" & changeType & "|" & Now())
    > End If
    > End If
    > Catch
    > End Try
    > End Sub
    >
    > Private Sub fsw_renamed(ByV al sender As Object, ByVal e As[/color]
    RenamedEventArg s)[color=blue]
    > Handles fsw.Renamed
    > 'If Not CBool(File.GetA ttributes(e.Ful lPath) And FileAttributes. Directory)
    > Then
    > fl.log(e.OldFul lPath & "|" & e.FullPath & "|renamed" & "|" & Now())
    > 'End If
    > End Sub
    >
    >[/color]


    Comment

    Working...