2012-09-25 115 views
9

我需要知道在python中每当一个新的文件被添加/删除/修改在一个特定的目录 有没有办法呢? 我正在寻找一个“inofity”式的功能(来自POSIX)。如何检查python文件夹中的文件已经改变?

感谢

+1

* python inotify * - > ** pyinotify ** https://github.com/seb-m/pyinotify/wiki – eumiro

+0

[我如何使用Python观看文件以进行更改?](http:/ /stackoverflow.com/questions/182197/how-do-i-watch-a-file-for-changes-using-python) –

回答

7

使用inotify-tools(在最初的版本中,我提到pyinotify,但它有问题,现在已被废弃,不推荐)。

+7

我不知道有多少这些问题已经解决:http://www.serpentine.com/blog/2008/01/04/why-you-should-not-use-pyinotify/ –

+0

请使用inotify(更新)python而不是pynotify(不建议使用)。 – serfer2

+0

@ serfer2更新了答案,谢谢! –

相关问题