在C#WinForms应用程序,我想选择网络,然后再来个目录,当任何机构把一个文件在里面,我希望看到一个消息,如A文件中添加。
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");
我应该运行此code 5分钟后,我应该检查的区别?
should I run this code 5 minutes later and should I check the differences?
您可以使用FileSystemWatcher类和订阅不同的事件发生的文件系统,如文件和文件夹上创建,删除,修改,...
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, ...