inotify --fromfile 指令

发布于 2024-12-15 16:07:46 字数 1333 浏览 1 评论 0原文

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

我安装了一个inotify util来玩。

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

inotifywait --fromfile ~/list.inotify

该命令可以轻松读取要读取和忽略的文件夹和文件列表。 有我的列表(list.inotify),

/home/alex

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

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

它也忽略 Torrent。但它不会忽略 .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.

I have a system fedora 15 with xfce window manager.

I installed an inotify util to play with.

I want to control, what happens with my files during my work process.
There is a command which i use today for running inotify

inotifywait --fromfile ~/list.inotify

That command easy read a list of folders and files to read and to ignore.
There is my list (list.inotify)

/home/alex

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

So it should read my home folder and ignore Torrents folder and .pulse-cookie file.

It ignores Torrents as well. But it won't ignore a .pulse-cookie file.

Any solution for this ? (please don't post a solution to use pattern based ignore, i want to work with a file list with absolute path's)

$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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无声无音无过去 2024-12-22 16:07:46

如果您未指定 -e 参数,inotifywait 将使用 IN_ALL_EVENTS 调用 inotify_add_watch,这会导致事件发生在监视目录内的文件 - 请注意 inotify(7) 说:

监视目录时,目录中的文件可能会发生上面标有星号(*)的事件,在这种情况下
返回的 inotify_event 结构中的 name 字段标识目录中文件的名称。

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

If you don't specify a -e argument, inotifywait will call inotify_add_watch with IN_ALL_EVENTS, which causes events to occur for files inside watched directories - note that inotify(7) says:

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.

If you have a look at the inotifywait code in question, you'll see that it only watches (and checks the exclude list against) directories. It would perhaps be a bit more user friendly if you were warned when specifying an exclusion that is not a directory or one that is never used, but that's the way it currently it is.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文