我在互联网上研究了很多,但无法解决这个问题。 这是我的代码:
m_Watcher.Filter = "*.*";
m_Watcher.Path = settings.FolderName;
m_Watcher.IncludeSubdirectories = true;
m_Watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
m_Watcher.Changed += new FileSystemEventHandler(OnChanged);
m_Watcher.Created += new FileSystemEventHandler(OnCreated);
m_Watcher.Renamed += new RenamedEventHandler(OnRenamed);
m_Watcher.EnableRaisingEvents = true;
每当我对单词或excel文件进行更改时,会生成太多临时文件,所有这些文件都被隐藏,到目前为止,我只是设法在执行时忽略这些临时文件和隐藏文件而无法检测到对实际文件。我怎么能这样做?