File System Watcher: file updated, created : File System Watcher « File Directory « VB.Net






File System Watcher: file updated, created

 
Imports System.IO

Module Module1
    WithEvents Watcher As New FileSystemWatcher("C:\")

    Sub Main()
        Watcher.Filter = "*.*"
        Watcher.IncludeSubdirectories = True
        Watcher.EnableRaisingEvents = True

        Console.ReadLine()
    End Sub
    Sub OnChanged(ByVal From As Object, ByVal e As FileSystemEventArgs) Handles Watcher.Changed

        Dim DateAndTime As DateTime = DateTime.Now

        Console.WriteLine(e.FullPath & " " _
           & e.ChangeType() & " " & DateAndTime)
    End Sub

End Module


           
         
  








Related examples in the same category

1.File System Watcher: File Folder Created
2.File Watcher