本文介绍了目录修改监视的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建一个C#应用程序,将监视修改和补充,并存储在数据库中的信息的指定目录下。

I'm building a C# application that will monitor a specified directory for changes and additions and storing the information in a database.

我想避免检查每个对于修改单个文​​件,但我不知道如果我能完全信任的文件访问时间。

I would like to avoid checking each individual file for modifications, but I'm not sure if I can completely trust the file access time.

什么是用于在获得最近修改的文件的最佳方法目录?

What would be the best method to use for getting recently modified files in a directory?

这将检查修改只有当用户要求它,它不会是一个持续运行的服务。

It would check for modifications only when the user asks it to, it will not be a constantly running service.

推荐答案

嗯......有趣的问题。最初,我在类点你。如果你想拥有它的工作,但是,用户的要求,那就似乎可能需要开始储存过的目录信息,然后每次比较用户的请求。我可能会去一个FileSystemWatcher的,只是储存了你的结果进不去。

Hmm... interesting question. Initially I'd point you at the FileSystemWatcher class. If you are going to have it work, however, on user request, then it would seem you might need to store off the directory info initially and then compare each time the user requests. I'd probably go with a FileSystemWatcher and just store off your results anyhow.

这篇关于目录修改监视的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 05:55