FileSystemWatcher Class - Excluding Directories
Determine if the file is a directory in your event handler, and do nothing then:
private void WatcherOnCreated(object sender, FileSystemEventArgs fileSystemEventArgs)
{
if (File.GetAttributes(fileSystemEventArgs.FullPath).HasFlag(FileAttributes.Directory))
return; //ignore directories, only process files
//TODO: Your code handling files...
}
You probably haven't read http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.filter.aspx. You cannot exclude anything with Filter property. It only includes objects matching filter.
If you want exclude something, do it in events fired by FSW.