如何使用 Python 监视和监视新创建的文件的 ftp 挂载点

2022-01-09 00:00:00 python ftp filesystems mount inotify

问题描述

我可以使用基于 inotify 内核子系统的解决方案来查看本地目录.还有一些 Python 项目也在 inotify 之上运行,例如 pyinotify、PyInotify, fsmonitor 和 看门狗.

I am able to watch local directories using inotify kernel subsystem based solutions. There are some python projects too which are working on top of inotify like pyinotify, PyInotify, fsmonitor and watchdog.

我已经使用 curlftpfs 在本地目录中安装了远程 ftp 服务器,所以现在所有同步都很容易.但 inotify 无法查看本地目录等网络挂载点.

I have mounted remote ftp server in local directory using curlftpfs so all syncing is easy now. But inotify is not able to watch network mounted points like local directories.

我想跟踪是否有新文件添加到 ftp 服务器.我怎样才能像使用基于 inotify 的解决方案的本地目录一样实现.

I want to track if there is new files added to ftp server. How can I achieve like I do for local directory using inotify based solution.


解决方案

它几乎无法工作.FTP 协议没有 API 来通知客户端有关更改.curlftpfs 必须不断地轮询远程文件夹以提供通知给 inotify 或其他类似工具.它几乎没有这样做.

It can hardly work. The FTP protocol has no API to notify a client about the changes. The curlftpfs would have to continually poll the remote folder to provide the notification for inotify or other similar tool. It hardly does that.

您必须自己轮询 FTP 文件夹.

You have to poll the FTP folder yourself.

参见例如 监控远程 FTP 目录.

相关文章