问题
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