简体   繁体   English

在C#中使用FileWatcher时如何排除某些文件夹?

[英]How to exclude some folders when using filewatcher in c#?

everyone, I recently wrote a program wanting to monitor the whole file system. 大家,我最近编写了一个程序,希望监视整个文件系统。 I use FileSystemWatcher class in c#. 我在c#中使用FileSystemWatcher类。 In order to watch the whole filesystem, I set IncludeSubdirectories to true. 为了监视整个文件系统,我将IncludeSubdirectories设置为true。 However, I also want to exclude three folders in monitoring. 但是,我也想在监视中排除三个文件夹。 I would like to know is there any way to exclude folders? 我想知道有什么方法可以排除文件夹吗? Thanks in advance! 提前致谢!

不幸的是,您仅可以包括,如果需要排除,则可以在FileSystemWatcher Event Handler内部进行处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM