473,396 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

FileSystemWatcher events being reported when non should be

I have just started using the FileSystemWatcher 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.writeline 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
..EnableRaisingEvents 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.IncludeSubdirectories = True
fsw.EnableRaisingEvents = True
fsw.NotifyFilter = fsw.NotifyFilter Or NotifyFilters.FileName Or
NotifyFilters.LastWrite Or NotifyFilters.Size

Private Sub fsw_All(ByVal sender As Object, ByVal e As FileSystemEventArgs)
Handles fsw.Created, fsw.Changed, fsw.Deleted
Dim changeType As String = [Enum].GetName(GetType(WatcherChangeTypes),
e.ChangeType)
Try
If changeType.ToLower = "deleted" Then
fl.log(e.FullPath & "||" & changeType & "|" & Now())
Else
If Not CBool(File.GetAttributes(e.FullPath) And FileAttributes.Directory)
Then
fl.log(e.FullPath & "||" & changeType & "|" & Now())
End If
End If
Catch
End Try
End Sub

Private Sub fsw_renamed(ByVal sender As Object, ByVal e As RenamedEventArgs)
Handles fsw.Renamed
'If Not CBool(File.GetAttributes(e.FullPath) And FileAttributes.Directory)
Then
fl.log(e.OldFullPath & "|" & e.FullPath & "|renamed" & "|" & Now())
'End If
End Sub
Jul 21 '05 #1
1 1248
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" <gl**********************@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I have just started using the FileSystemWatcher 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.writeline 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
.EnableRaisingEvents 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.IncludeSubdirectories = True
fsw.EnableRaisingEvents = True
fsw.NotifyFilter = fsw.NotifyFilter Or NotifyFilters.FileName Or
NotifyFilters.LastWrite Or NotifyFilters.Size

Private Sub fsw_All(ByVal sender As Object, ByVal e As FileSystemEventArgs) Handles fsw.Created, fsw.Changed, fsw.Deleted
Dim changeType As String = [Enum].GetName(GetType(WatcherChangeTypes),
e.ChangeType)
Try
If changeType.ToLower = "deleted" Then
fl.log(e.FullPath & "||" & changeType & "|" & Now())
Else
If Not CBool(File.GetAttributes(e.FullPath) And FileAttributes.Directory)
Then
fl.log(e.FullPath & "||" & changeType & "|" & Now())
End If
End If
Catch
End Try
End Sub

Private Sub fsw_renamed(ByVal sender As Object, ByVal e As RenamedEventArgs) Handles fsw.Renamed
'If Not CBool(File.GetAttributes(e.FullPath) And FileAttributes.Directory)
Then
fl.log(e.OldFullPath & "|" & e.FullPath & "|renamed" & "|" & Now())
'End If
End Sub

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Troy Murphy | last post by:
How do I prevent the FileSystemWatcher event to keep firing while the file is being created? When copying a file to the watched folder, the event fires a dozen or more times! Also, the...
3
by: Stampede | last post by:
Hi, I want to use the FileSystemWatcher in a Windows Service. I read an article, where the author created the FileSystemWatcher object in a seperate thread and when the event is fired, he started...
1
by: yogesh | last post by:
hello I getting problem in FileSystemWatcher , I had wrriten the code for the FileSystemWatcher , when i dropping the new file in the directory , the WatcherEdi_Created event get fired , but...
1
by: Glenn | last post by:
I have just started using the FileSystemWatcher 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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.