在文件系统观察器的文件夹中移动文件 [英] Moving a file in a folder in file system watcher

查看:105
本文介绍了在文件系统观察器的文件夹中移动文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用文件系统监视程序.我想最大限度地利用它.文件系统监视程序是否可以记录事件,例如将特定文件移动到正在监视的驱动器上的一个文件夹中.例如,"me.txt已移至E:\ New文件夹"而不是在E:\ New文件夹中创建了me.txt".每当我创建一个新文件夹时,通常我都会重命名它,这样我就可以记住.但是文件系统监视程序记录的内容类似在E:\中创建了新文件夹",然后记录了"E:\ New文件夹已重命名为Hello".是否可以仅记录"Hello已在E:\中创建"?我只是非常想了解FS Watcher的更多信息,希望大家能对我有所帮助.

I am using a file system watcher. I want to maximize its use. Is it possible that file system watcher can record the event like moving a particular file in one of the folders on the drive that is being watched. Example, "me.txt was moved to E:\New Folder" instead of "me.txt was created at E:\New Folder".. Is it possible? And whenever I create a New Folder, usually Im renaming it so that I can remember. But the file system watcher records something like "New Folder has been created at E:\" followed by "E:\New Folder has been renamed to Hello". Is it possible to just record, "Hello has been created at E:\"? I just really want to learn more about FS Watcher so I hope you guys can help me. Thank you in advance!

推荐答案

FileSystemWatcher可用于监视文件夹的内容是否为Created, Changed, Deleted or Renamed.您只需要订阅这些事件中的任何一个,就可以控制这些事件发生时Watcher的操作.

这是 FileSystemWatcher [
The FileSystemWatcher can be used to monitor whether the contents of a folder have been Created, Changed, Deleted or Renamed. You just need to subscribe to any of those events, and you can control what the Watcher does when those events happen.

Here is the MSDN Article on FileSystemWatcher[^]

Hope that helps


这篇关于在文件系统观察器的文件夹中移动文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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