FileSystemWatcher is a very powerful utility built into the .NET Framework. It allows us to watch and monitor any folder on our or remote computers for file changes. FileSystemWatcher is useful when using a folder as a Queue. For example: if you have a website that accepts file uploads and then distributes the files to media encoding servers or a CDN, you may want to use this class.
FileSystemWatcher is a part of System.IO.
You can use it as folows:
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = @"C:\UploadedMedia\";
watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.CreationTime;
watcher.Filter = "*.*";
watcher.Created += new FileSystemEventHandler(watcher_Created);
watcher.EnableRaisingEvents = true;
static void watcher_Created(object sender, FileSystemEventArgs e)
{
// Move to encoding server
}
Posted
19 Aug 2009 5:10 AM
by
Gal Ratner