Search code examples
c#filesystemwatcher

class that trigger when file change


I want to store an actually version of each filename into a textfile. And i want to update the textfile if a file changes

How can i look if file in given directory changes? for example changes file name or size e.g.? using C#

i have tried to look at all files using System.IO in a loop every 10 seconds but i hope there is a better way to do

Is there a class in c# which fires when files changed?


Solution

  • yes, there is

    FileSystemWatcher