C# : file copy notifying [closed]

一曲冷凌霜 提交于 2020-01-11 10:53:27

问题


hi i am creating a c# application that monitor the files that has been copied , the aim of program is to alert user that there is a file has been copied , i know the file system watcher class , but it has only 4 events , change or create or delete or rename , is there a way to know if file has been copied in or out of system ?


回答1:


When a file is copied into the system you will also get a change or create event. But if it is simply accessed (which is what happens when it is copied) FileSystemWatcher is of no use.

You can use Auditing file and folder access feature of Windows.




回答2:


The task makes no sense. First of all, there's no "copy" operation on the OS level. Copy is a sequence of open/read/close (source) + create/write/close (dest) operations. Now, even if such operation existed (eg. Explorer has such concept), what about archiving the file and then copying out the archive?



来源:https://stackoverflow.com/questions/8759381/c-sharp-file-copy-notifying

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