目录修改监控 [英] Directory Modification Monitoring

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

问题描述

我正在构建一个C#应用程序,它将监视指定的目录以进行更改和添加,并将信息存储在数据库中。



我想避免检查每个个人文件进行修改,但我不知道我是否可以完全信任文件访问时间。



最近使用哪种方法获取最近修改的文件是什么一个目录?



只有当用户询问它时,才会检查修改,它不会是一个不断运行的服务。

解决方案

嗯...有趣的问题。最初我会指出你在 FileSystemWatcher 课程。但是,如果要使其正常工作,则根据用户请求,您可能需要首先存储目录信息,然后在每次用户请求时进行比较。我可能会和FileSystemWatcher一起去,只是存储你的结果。


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.

解决方案

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.

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

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