I have the following sub:
Private Sub Watcher_Changed(ByVal sender As System.Object, ByVal e As FileSystemEventArgs)
If Path.GetExtension(e.Name) = ".p2p" Then
Exit Sub
Else
Try
' multiple change events can be thrown. Check that file hasn't already been moved.
While Not File.Exists(e.FullPath)
Exit Try
End While
' throw further processing to a BackGroundWorker
ChangedFullPath = e.FullPath
ChangedFileName = e.Name
FileMover = New BackgroundWorker
AddHandler FileMover.DoWork, New DoWorkEventHandler(AddressOf ProcessFile)
FileMover.RunWorkerAsync()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
End Sub
I'm still getting multiple changed-file notifications when a file is being uploaded by FTP.
I want to modify the Try so it also throws out the change notification if it has happened within the past (time) -- let's say 3 seconds. It ought to be trivial, but for some reason it isn't coming to me today, and my mind isn't wrapping itself around the answers I'm finding on Google.
Thanks, Scott