473,406 Members | 2,867 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,406 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 1249
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
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.