0

所以我知道您可以将文件排除在观看之外,但是另一种方式呢?如果我只想看 *.txt 怎么办?

4

1 回答 1

3

Just pass the names you want to watch as arguments:

intotifywait ... *.txt

If you are concerned the pattern will match too many files to fit on the command line, you can use the --fromfile arguments to read the list of files to monitor from a file. The file needs to contain the actual file names, not a pattern, so you might need to create the file with something like

for f in *.txt; do printf '%s\n' "$f"; done > files.txt
inotifywait --fromfile files.txt ...
于 2016-09-29T18:03:24.053 回答