Monitoring file changes in C #

I use C # for my mini-project, I try to control files that have been modified, deleted and / or created. And export it to a file. But I'm not quite sure how to control the files. Any ideas?

+7
c # file project
source share
3 answers

You can use the FileSystemWatcher class to monitor the creation, modification, deletion, and renaming of files.

The following events are available:

+12
source share

Yep, FileSystemWatcher will do this. Be careful what you want, because this thing is watching everything!

Look here , it explains how you can fire several events (for example, when a file is moved, launch OnChange and OnCreate

+2
source share

you can only track one directory with FSW, if you need more, you may need to make several instances of FSW. It controls the directory, not the file; if the file is moved ( changed + created ; changed + renamed ), then you will need another FSW for this target folder.

+2
source share

All Articles