目前我正在試圖排除與FileSystemWatcher類目錄,雖然我已經使用這個:FileSystemWatcher類 - 排除目錄
FileWatcher.Filter = "C:\\$Recycle.Bin";
和
FileWatcher.Filter = "$Recycle.Bin";
它編譯好的,但沒有結果顯示當我嘗試這個。
如果我參加了過濾掉,所有的文件加載罰款,代碼如下:
static void Main(string[] args)
{
string DirPath = "C:\\";
FileSystemWatcher FileWatcher = new FileSystemWatcher(DirPath);
FileWatcher.IncludeSubdirectories = true;
FileWatcher.Filter = "*.exe";
// FileWatcher.Filter = "C:\\$Recycle.Bin";
// FileWatcher.Changed += new FileSystemEventHandler(FileWatcher_Changed);
FileWatcher.Created += new FileSystemEventHandler(FileWatcher_Created);
// FileWatcher.Deleted += new FileSystemEventHandler(FileWatcher_Deleted);
// FileWatcher.Renamed += new RenamedEventHandler(FileWatcher_Renamed);
FileWatcher.EnableRaisingEvents = true;
Console.ReadKey();
}
瘋狂的事情,actualy我,我只是想知道如果有一個備用根,感謝您的幫助,雖然! :) – Ken 2011-05-19 22:24:15