How to check in python that a file in a folder has changed?

大憨熊 提交于 2019-11-26 20:57:37

问题


I need to know in python whenever a new file was added/removed/modified in a particular directory Is there a way for that? I'm looking for an "inofity"-like function (from POSIX).

Thanks


回答1:


Use inotify-tools (In the original version, I mentioned pyinotify, but it had issues, and now is deprecated and not recommended).




回答2:


You can use inotify for python, which is NOT the same as PyInotify (older).




回答3:


As mentioned in the similar question, you might want to have a look at http://packages.python.org/watchdog/ which also works on Windows.



来源:https://stackoverflow.com/questions/12582720/how-to-check-in-python-that-a-file-in-a-folder-has-changed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!