removeWatchTargetRecursive(3) Library Functions Manual removeWatchTargetRecursive(3)

removeWatchTargetRecursive - 从监听列表中移除指定的文件

#include <libkyfilewatcher.hpp>


class KYSDK_FILEWATCHER::FileWatcher


QStringList removeWatchTargetRecursive(QString url, int maxdepth = 5, int recurType = ALLFILE);

Link with -lkyfilewatcher.

The main function of the interface is to remove the specified file from the listening list.

The argument url is the file path.

The argument maxdepth is the maximum depth specified for traversal search.

The argument recurType is the recursive type,which is an enumeration type. The content is as follows:


enum RecursiveType{
DIR = 1 << 0,
REGULAR = 1 << 1,
HIDDEN = 1 << 2,
TMPFILE = 1 << 3, //认为那些以~开头的是临时文件
ALLFILE = HIDDEN | TMPFILE | DIR | REGULAR
};

#include <QCoreApplication>
#include <QDebug>
#include "libkyfilewatcher.hpp"
using namespace KYSDK_FILEWATCHER;
int main(int argc, char *argv[])
{
    KYSDK_FILEWATCHER::FileWatcher watcher;
    watcher.addWatchTargetRecursive("/home/kylin/", PERIODIC, ALL, 3, REGULAR);
    getchar();
//    qDebug() << "update attr test";
//    watcher.updateWatchTargetAttribute("/data/testcode/test.c", DELETE);
//    getchar();
//    qDebug() << "re-add test";
//    watcher.addWatchTarget("/data/testcode/test.c", PERIODIC, ALL);
//    getchar();
//    qDebug() << "update oneshot test";
//    watcher.updateWatchTargetType("/data/testcode/test.c", ONESHOT);
//    getchar();
//    qDebug() << "remove target test";
//    watcher.removeWatchTarget("/data/testcode/test.c");
//    getchar();
    watcher.clearWatchList();
    return 0;
}

These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: addWatchTargetRecursive(), addWatchTargetListRecursive(), clearWatchList(), pauseWatcher() and restartWatcher().

addWatchTargetRecursive(3), addWatchTargetListRecursive(3), clearWatchList(3), pauseWatcher(3) and restartWatcher(3).

Wed Sep 20 2023 My Project