开发者

c# detect directory change

开发者 https://www.devze.com 2023-04-11 19:47 出处:网络
I use FileSystemWatcher in C# to monitor a dir开发者_Python百科ectory.It is well documented (and well complained about) that FileSystemWatcher works fine to detect changes in the directory, but not ch

I use FileSystemWatcher in C# to monitor a dir开发者_Python百科ectory. It is well documented (and well complained about) that FileSystemWatcher works fine to detect changes in the directory, but not changes to the directory. To get around that I am checking directory existence every second but what a waste. I need to know if something changes in the directory and if the directory is deleted or renamed. Is there a better way without polling?


You could monitor parent directory AND set Filter property to your folder's name to get only events for the folder AND set IncludeSubdirectories to true.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号