[英]FileSystemWatcher can not detect the change of 1 file (add a new file), only detect atleast 2 files
[英]FileSystemWatcher can not detect right file name
ERP SAP
将数据写入我的 windows 文件夹 (...\\Item)。 文件夹上的文件是DEV_CM_ARTMAS_20160329-152112-466.xml
但是当 FileSystemWatcher 引发 Onchange 时。 FileSystemEventArgs.Name 是Item_Temp326024f0-f587-11e5-8a81-00000018263a
那么我如何在 C# Item_Temp326024f0-f587-11e5-8a81-00000018263a to string DEV_CM_ARTMAS_20160329-152112-466.xml
转换Item_Temp326024f0-f587-11e5-8a81-00000018263a to string DEV_CM_ARTMAS_20160329-152112-466.xml
我想第一个 Changed 事件发生在开始写入临时文件时。 复制所有字节后,文件将重命名为正确的条目。
在这种情况下,您可以捕获 Renamed 事件而不是 Changed 或尝试使用过滤器(例如在文件扩展名上)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.