我想创建一个简单的应用程序,什么将所有文件writed到一些目录到其他目录。这是我的问题:如果我一次在我的目录中写入超过10000个文件(超过1KB的小型.txt文件) - 其中一些文件无法在输出目录上移动。我正在使用FileSystemWatcher事件处理程序来解决此问题。这里是我的代码示例:从FileSystemWatcher捕获丢失事件C#
Class MyProgramm
{
void Process(Object o, FileSystemEventArgs e)
{
//do something with e.Name file
}
void main()
{
var FSW = New FileSystemWatcher{Path = "C:\\InputDir"};
FSW.Created += Process;
FSW.EnableRisingEvents = true;
Thread.Sleep(Timeout.Infinite);
}
}
最后,我们得到了一些文件处理,但有些书面文件撑未处理.. 有什么建议?
的可能重复[FileSystemWatcher的VS轮询来监视文件更改(http://stackoverflow.com/questions/239988/filesystemwatcher-vs-polling-to-watch-for-file-更改) –
请澄清您的问题。这是FileSystemWatcher无法检测到移动文件的问题吗?或者是文件本身无法从输入转到输出目录? –
看看相关文章http://stackoverflow.com/questions/1286114/detecting-moved-files-using-filesystemwatcher –