监控文件/目录的内容? [英] Monitoring contents of files/directories?

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

问题描述

我正在寻找一个跨平台文件监视python包?我知道可以使用pywin32来监视Windows上的文件,并且有一些程序包在Linux / Unix上工作,但是有人知道一个跨平台的程序吗?

解决方案

对于基于Unix / Linux的系统,您应该使用文件更改监视器Python绑定 libfam



对于基于Windows的系统,您应该绑定到Win32 API FindFirstChangeNotification 及相关功能。



对于跨平台的方式,我不知道一个很好的跨平台方式。我认为最好是自己构建一个模块,该模块可以在任何一个操作系统上运行,该模块在检测到操作系统之后,使用上述2种方法之一。


I'm looking for a cross-platform file monitoring python package? I know it is possible to monitor files on windows using pywin32, and there are packages working on Linux/Unix but does anyone know about a cross-platform one?

解决方案

For Unix/Linux based systems, you should use File Alteration Monitor Python bindings to libfam.

For Windows based systems, you should tie into the Win32 API FindFirstChangeNotification and related functions.

As for a cross platform way, I don't know about a good cross platform way. I think it would be best to build a module yourself that works on either OS that uses one of the 2 above methods after detecting what OS it is.

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

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