FileSystemWatcher not raising when files are copied or moved to folder [duplicate]

那年仲夏 提交于 2019-11-29 12:07:57

I used FileSystemWatcher in one of my Home application. But FileSystemWatcher do not have any move or copy detection events as per my knowledge.

As per MSDN

Copying and moving folders

The operating system and FileSystemWatcher object interpret a cut-and-paste action or a move action as a rename action for a folder and its contents. If you cut and paste a folder with files into a folder being watched, the FileSystemWatcher object reports only the folder as new, but not its contents because they are essentially only renamed.

For more information click here.

What I did was monitoring the parent folder and sub folders and logged every changes in it. To include sub directories I used the following property.

watcher.IncludeSubdirectories=true;

Some googling suggesting to use timer to detect changes. But I don't know how effective it is.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!