addWatchTargetRecursive(3) Library Functions Manual NAME addWatchTargetRecursive - SYNOPSIS #include Classes class KYSDK_FILEWATCHER::FileWatcher Functions QStringList addWatchTargetRecursive(QString url, FileWatcherType type = PERIODIC, int attr = OPEN|CLOSE|MODIFY|DELETE, int maxdepth = 5, int recurType = DIR|REGULAR); Link with -lkyfilewatcher. Detailed Description The main function of the interface is to add file paths that need to be listened to, and for directories, recursive listening subdirectories are enabled by default. The argument url is the file path. The argument type is the file watcher typewhich is an enumeration type. The content is as follows: enum FileWatcherType{ ONESHOT = 0, // add PERIODIC, NEVER }; The argument attr is the file watcher attributewhich is an enumeration type. The content is as follows: enum FileWatcherAttribute{ ACCESS = IN_ACCESS, CREATE = IN_CREATE, MODIFY = IN_MODIFY, DELETE = IN_DELETE | IN_DELETE_SELF, ATTRIB = IN_ATTRIB, MOVE = IN_MOVE | IN_MOVE_SELF, OPEN = IN_OPEN, CLOSE = IN_CLOSE, ALL = IN_ALL_EVENTS }; The argument maxdepth is the maximum depth specified for traversal search. The argument recurType is the recursive typewhich 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 }; RETURN VALUE EXAMPLES #include #include #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; } CONFORMING TO These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: addWatchTargetListRecursive(), removeWatchTargetRecursive(), clearWatchList(), pauseWatcher() and restartWatcher(). SEE ALSO addWatchTargetListRecursive(3), removeWatchTargetRecursive(3), clearWatchList(3), pauseWatcher(3) and restartWatcher(3). My Project Wed Sep 20 2023 addWatchTargetRecursive(3)