Ich muss die Verzeichnisstruktur unseres Produktionssystems drucken und möchte bestimmte Verzeichnisse aus dem Baum entfernen?
Wie spezifizieren wir mehrere Ignoriermuster für tree
Befehl?
Akzeptierte Antwort:
Sie geben einfach alle Muster an das -I
weiter Befehl, getrennt durch |
. Aus der Manpage:
-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.
Also zum Beispiel
tree -I 'test*|docs|bin|lib'
überspringt die Verzeichnisse „docs“, „bin“ und „lib“ sowie alle Verzeichnisse mit „test“ im Namen, wo immer sie in der Verzeichnishierarchie liegen mögen. Natürlich können Sie Platzhalter für eine viel leistungsfähigere Übereinstimmung verwenden.