通过Java进行文件系统更改监视 [英] File System Change Monitoring through Java

查看:179
本文介绍了通过Java进行文件系统更改监视的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过java监视系统上选定目录的变化。我对java 7中的 watchservice 有一些想法。但watchservice只返回发生更改事件(MODIFY,DELETE)的目录名称。另一方面,我希望获得所有有关更改的信息,例如,进行更改的用户,发生更改的时间等。

就像想读取NTFS文件系统上的更改日志一样。 Java中有没有其他方法可以异步记录这些更改? ...

在此先感谢。

解决方案

你有能力添加导入库到你的项目,但commons-io有一个FileAlterationObserver,可以满足你的需要:
$ b

http://commons.apache.org/io/api-release/org/apache/ commons / io / monitor / FileAlterationObserver.html


I want to monitor changes with selected directories on my system through java. I have bit idea about watchservice in java 7. But watchservice only returns directory name to which change event (MODIFY, DELETE) occurs. On the other side, I want all information about change like user who made changes, time at which change takes place etc.

It is something like a want to read change journals on NTFS file system. Is there any other way available in Java to record such changes asynchronously ? ...

Thanks in advance.

解决方案

Not sure if you have the capability to add import libraries to your project but commons-io has a FileAlterationObserver that may suit your needs:

http://commons.apache.org/io/api-release/org/apache/commons/io/monitor/FileAlterationObserver.html

这篇关于通过Java进行文件系统更改监视的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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