本番システムのディレクトリ構造を印刷する必要があり、ツリーから特定のディレクトリを削除したいですか?
tree
に複数の無視パターンを指定するにはどうすればよいですか コマンド?
承認された回答:
すべてのパターンを-I
に提供するだけです |
で区切られたコマンド 。マンページから:
-P pattern
List only those files that match the wild-card pattern. Note:
you must use the -a option to also consider those files begin‐
ning with a dot `.' for matching. Valid wildcard operators are
`*' (any zero or more characters), `?' (any single character),
`[...]' (any single character listed between brackets (optional
- (dash) for character range may be used: ex: [A-Z]), and
`[^...]' (any single character not listed in brackets) and `|'
separates alternate patterns.
-I pattern
Do not list those files that match the wild-card pattern.
たとえば、
tree -I 'test*|docs|bin|lib'
「docs」、「bin」、「lib」、ディレクトリ、および名前に「test」が含まれるディレクトリは、ディレクトリ階層内のどこにあってもスキップします。もちろん、ワイルドカードを適用して、はるかに強力なマッチングを行うことができます。