FileSystemWatcher Exclude File Type

I have a simple filesystemwatcher and want to exclude all .log file types - any examples would be great!!!
tbaseflugAsked:
Who is Participating?
 
Bob LearnedCommented:
 Private Sub FileSystemWatcher1_Changed(ByVal sender As System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Changed

    If System.IO.Path.GetExtension(e.FullPath).ToLower <> ".log" Then

    End If

  End Sub

Bob
0
 
Bob LearnedCommented:
Are you looking for *.*, with the exception of *.log?

The FileSystemWatcher.Filter property can filter one type, but if you are looking to get everything but .log files, then you can use an If...Then block within the event to skip processing any file types with that extension using the System.IO.Path.GetExtension method.

Bob
0
 
tbaseflugAuthor Commented:
TheLearnedOne -

That is exactly what I am lookign to do - can you provide me with a quick sample of code?
0
 
tbaseflugAuthor Commented:
TheLearnedOne  -

Perfect - thanks!!!!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.