开发者

How to watch a directory for changes? [duplicate]

开发者 https://www.devze.com 2023-02-05 04:19 出处:网络
This question already has answers here: Monitoring contents of files/directories? [duplicate] (5 answers)
This question already has answers here: Monitoring contents of files/directories? [duplicate] (5 answers) 开发者_StackOverflow Closed 9 years ago.

Could not find anything in python core to do this. Can anyone recommend a library or "battery" to do this? Ideally I would like this to be portable but it's OK if it is available only for Unix (my server).


On Linux, you could be interested in pyinotify

  1. https://github.com/seb-m/pyinotify

Other related libraries:

  1. http://people.gnome.org/~veillard/gamin/python.html
  2. Python FAM interface: http://python-fam.sourceforge.net/
  3. http://gorakhargosh.github.com/watchdog/


I don't think there's something portable for this kind of requirement. That's too close to the OS IMO. Otherwise for Linux, there's pynotify. pyinotify is a binding for Linux inotify kernel filesystem notification subsystem. Works quite well.


I was just looking for a python package that watches file modifications. Just stumbled upon pywatch and it might just be what you're looking for. It's very simple, but does what I need (fixing pyScss' lack of a watcher).

http://pypi.python.org/pypi/pywatch

0

精彩评论

暂无评论...
验证码 换一张
取 消