希望应用程序使用FileSystem Watcher或任何其他方法来查看目录。 [英] want a application to watch Directory using FileSystem Watcher or any other method.

查看:88
本文介绍了希望应用程序使用FileSystem Watcher或任何其他方法来查看目录。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我希望应用程序使用FileSystem Watcher或任何其他方法观看目录。



如果任何文件粘贴在该目录中,我可以移动或执行任何其他操作。



如果我粘贴单个文件它工作正常。

如果我粘贴多个文件,它只是占用最后一个文件并忽略其余文件。



我正在使用codeproject下面的程序



C#:使用FileSystem Watcher监视文件或目录的应用程序 [ ^ ]







你能帮我吗?



谢谢你。



Asutosha

Hi All,

I want a application to watch Directory using FileSystem Watcher or any other method.

if any file(s) paste in that directory , I can move or do any other action.

if i paste single file it is working fine.
if i paste multiple file it is just taking last file and ignore rest of the files.

I am using below program from codeproject

C#: Application to Watch a File or Directory using FileSystem Watcher[^]



Can you help me in this?

thanks you.

Asutosha

推荐答案

Hello Asutosha,



MSDN文档 FileSystemWatcher类的[ ^ ]清楚地概述了您所面临的问题。

Hello Asutosha,

The MSDN documentation[^] for FileSystemWatcher class clearly outlines the problem you are facing.
Windows操作系统会在FileSystemWatcher创建的缓冲区中通知组件文件更改。如果在短时间内有许多变化,缓冲区可能会溢出。这会导致组件无法跟踪目录中的更改,并且只会提供一揽子通知。使用InternalBufferSize属性增加缓冲区的大小是昂贵的,因为它来自无法换出到磁盘的非分页内存,因此请保持缓冲区尽小但足够大,以免错过任何文件更改事件。为避免缓冲区溢出,请使用NotifyFilter和IncludeSubdirectories属性,以便过滤掉不需要的更改通知。
The Windows operating system notifies your component of file changes in a buffer created by the FileSystemWatcher. If there are many changes in a short time, the buffer can overflow. This causes the component to lose track of changes in the directory, and it will only provide blanket notification. Increasing the size of the buffer with the InternalBufferSize property is expensive, as it comes from non-paged memory that cannot be swapped out to disk, so keep the buffer as small yet large enough to not miss any file change events. To avoid a buffer overflow, use the NotifyFilter and IncludeSubdirectories properties so you can filter out unwanted change notifications.



希望这可以帮助您更正代码。



问候,


Hope this helps you correct your code.

Regards,


这篇关于希望应用程序使用FileSystem Watcher或任何其他方法来查看目录。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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