开发者

How can I watch a file system directory to see when files are added to it?

开发者 https://www.devze.com 2023-04-09 21:31 出处:网络
In c# winforms application, I want to choose a directory from network and after that, when any body put a file in it, I want to see a message such as \"A file added.\"

In c# winforms application, I want to choose a directory from network and after that, when any body put a file in it, I want to see a message such as "A file added."

for example I can get filepaths.

string[] filePaths = Directory.GetFiles(@"c:\MyDir\", "*.bmp");

should I run this code 5 minutes later and shoul开发者_C百科d I check the differences?


You could use the FileSystemWatcher class and subscribe for different events happening on the file system such as files and folders being created, deleted, modified, ...

0

精彩评论

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

关注公众号