文件复制事件到可移动设备 [英] File Copy Events to Removable devices

查看:98
本文介绍了文件复制事件到可移动设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要记录所有复制到USB驱动器的文件.
另外,我需要知道要复制带有路径和目标位置的文件吗?

在此有类似的解决方案
http://social.technet.microsoft.com/论坛/zh-CN/ITCG/thread/68c39481-bbdd-4866-a8f3-3e4c6f163fe0

但是我无法理解它是用什么语言写的.

请帮忙.

I need to log all files copied to a usb drive.
Also, I need to know what file is being copied with path and the destination location?

There is sort of a similar solution on this
http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/68c39481-bbdd-4866-a8f3-3e4c6f163fe0

But I''m unable to understand what language it has been written in.

Please help.

推荐答案

您能做的最好的事情是枚举所有当前插入的USB存储设备(并处理此类设备的添加/删除系统事件),然后使用SystemFileWatcher对象以监视这些驱动器.我写了一个由两部分组成的文章系列,有关如何使用您可能想检出的FileSystemWatcher对象:

FileSystemWatcher-纯混沌(第1部分,共2部分) [ FileSystemWatcher-纯混沌(第2部分,共2部分) [
The best you can do is enumerate all currently inserted USB storage devices (and handle the add/remove system events for such devices), and then use the SystemFileWatcher object to monitoir those drives. I wrote a 2-part article series about using the FileSystemWatcher object that you might want to check out:

FileSystemWatcher - Pure Chaos (Part 1 of 2)[^]

FileSystemWatcher - Pure Chaos (Part 2 of 2)[^]


这是一个MOF文件,不是正常的编程语言. MOF是托管对象格式.该示例使用WMI通知电子邮件收件人在某个驱动器号上正在创建文件.

阅读WMI和MOF文件,您将可以实现此功能.

无法确定是要复制文件还是只是将数据写入驱动器上的文件.文件复制操作只不过是为读取访问打开源文件,为写入访问打开目标文件.然后读取源文件,并将数据写入目标文件.没有什么特别的说法表明该操作实际上是复制操作.
That''s a MOF file, not a normal programming language. MOF is Managed Object Format. That example is using WMI to notify an email recipient that a file is being created on a certain drive letter.

Read up on WMI and MOF files and you''ll be able to implement this.

There is no way to determine is a file is being copied or if data is just being written to a file on a drive. A file copy operation is nothing more than opening the source file for Read access and the destination file for Write access. Then the source file is read and the data written to the destination file. There''s nothing special that says that this operation is really a copy operation.


Thnks John Simmons,
这篇文章对我有很大的帮助,我下载了Demo,可以完美运行(好像您不知道),尽管我没有在可移动设备上对其进行过测试.希望如此.
最后,是否有什么东西可以显示复制的内容/复制的文件的屏幕快照....我知道这似乎很遥远...只是很好奇.如果是这样,请让我知道.再次感谢. L8r.
Thnks John Simmons,
The article was a great help,I downloaded the Demo,works perfectly( as if you didnt know),i havent though tested it on the removable devices.Hope that works.
finally,is there sumthing that would show the contents copied/some kind of a screenshot of the files copied....i know it seems like a far cry...just curious.If so,please let me know.Thanks again.L8r.


这篇关于文件复制事件到可移动设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆