aizuyan/inotify

recursive monitor file and directory based on inotify-tools

v3.0.0 2016-10-13 11:49 UTC

This package is not auto-updated.

Last update: 2024-10-02 20:11:02 UTC


README

文件、文件夹递归监控变动

使用例子

$obj = new Aizuyan\Inotify\Inotify();

$obj->addExclude([
    "/swp$/",
    "/swpx$/",
    "/~$/",
    "/\d$/",
    "/swx$/"
])->setCallback(function ($item){
    echo $item["event"] . " 文件 " . $item["file"] . "\n";
})->addPaths("/datas/git/")->start();

运行之后修改保存文件的时候会显示下面的内容:

CREATE 文件 /datas/git/inotify/README.md
MODIFY 文件 /datas/git/inotify/README.md
MOVED_TO 文件 /datas/git/aizuyan/pinyin-1/README.md
DELETE 文件 /datas/git/aizuyan/pinyin-1/LICENSE
。。。。。。

安装

要使用这个功能,需要在机器上安装inotify-tools,只能在linux\unix上使用

yum install inotify-tools