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

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

问题描述

我在找一个跨平台的文件监控python包?我知道可以使用 pywin32 监视 Windows 上的文件,并且有在 Linux/Unix 上运行的软件包,但有人知道跨平台的软件包吗?

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?

推荐答案

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

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

对于基于 Windows 的系统,您应该绑定到 Win32 API FindFirstChangeNotification 及相关函数.

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天全站免登陆