I'm using C# for a mini project of mine, I am trying to monitor files that are changed, Deleted, And/or created. And export that to a file. But I am not quite sure how to monitor files. Any ideas?
You can use the FileSystemWatcher
class to monitor file creation, modifications, deletions and renames.
You have the following events available:
Changed
Created
Deleted
Renamed
you can only monitor one Directory with FSW, if you want more you may have to make multiple instances of FSW. It monitors the directory not the file; if the file is moved (changed
+created
; changed
+renamed
) then you need another FSW for that destination folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With