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
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
Comment