inotify --fromfile 指令
我有一个带有 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您未指定
-e
参数,inotifywait
将使用IN_ALL_EVENTS
调用inotify_add_watch
,这会导致事件发生在监视目录内的文件 - 请注意 inotify(7) 说:如果您查看有问题的 inotifywait 代码,您会看到它只监视(并检查排除列表)目录。如果您在指定不是目录或从未使用过的排除项时收到警告,这可能会更加用户友好,但目前情况就是这样。
If you don't specify a
-e
argument,inotifywait
will callinotify_add_watch
withIN_ALL_EVENTS
, which causes events to occur for files inside watched directories - note that inotify(7) says: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.