gpt4 book ai didi

linux - inotify --fromfile 指令

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:28:08 25 4
gpt4 key购买 nike

我有一个带有 xfce 窗口管理器的系统 fedora 15。

我安装了一个 inotify 工具来玩。

我想控制我的文件在我的工作过程中会发生什么。我今天使用一个命令来运行 inotify

inotifywait --fromfile ~/list.inotify

该命令很容易读取要读取和忽略的文件夹和文件列表。有我的列表(list.inotify)

/home/alex

@/home/alex/Torrnets/
@/home/alex/.pulse-cookie

因此它应该读取我的主文件夹并忽略 Torrents 文件夹和 .pulse-cookie 文件。

它也忽略种子。但它不会忽略 .pulse-cookie 文件。

有什么解决办法吗? (请不要发布使用基于模式的忽略的解决方案,我想使用具有绝对路径的文件列表)

$man inotify
@<file>
When watching a directory tree recursively, exclude the specified file from being watched. The file must be specified with a relative or absolute path according to whether a relative or absolute path is given for watched directories. If a specific
path is explicitly both included and excluded, it will always be watched.

Note: If you need to watch a directory or file whose name starts with @, give the absolute path.

--fromfile <file>
Read filenames to watch or exclude from a file, one filename per line. If filenames begin with @ they are excluded as described above. If <file> is `-', filenames are read from standard input. Use this option if you need to watch too many files to
pass in as command line arguments.

最佳答案

如果你没有指定-e参数,inotifywait会调用inotify_add_watchIN_ALL_EVENTS,这导致监视目录内的文件发生事件 - 请注意 inotify(7)说:

When monitoring a directory, the events marked with an asterisk (*) above can occur for files in the directory, in which case the name field in the returned inotify_event structure identifies the name of the file within the directory.

如果您查看 inotifywait code in question ,您会看到它只监视(并检查排除列表)目录。如果您在指定不是目录或从未使用过的排除项时收到警告,这可能会更加用户友好,但目前就是这样。

关于linux - inotify --fromfile 指令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8111835/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com