Ignore patterns¶
-I takes the same wildcard patterns as tree -I, matched against each
entry's name — never its path, so -I 'src/*.pyc' matches nothing, exactly
as in tree.
| Operator | Matches |
|---|---|
* |
Zero or more characters |
? |
Any single character |
[abc], [a-z] |
One character from the set |
[^abc] |
One character not in the set |
| |
Either alternate |
trailing / |
Restricts the pattern to directories |
The trailing slash¶
This is the one worth internalising: it is the difference between hiding a folder and hiding everything that shares its naming convention.
arbol . -I '__*__/' -I '*.pyc'
That drops every __pycache__ folder and every stray .pyc, while keeping
__init__.py — the slash confined the first pattern to directories, and the
second names files. Ignoring a directory ignores everything beneath it.
Without the slash, a pattern matches both kinds of entry:
| Pattern | Effect |
|---|---|
.* |
Drops dot entries — .git/ and .gitignore |
.*/ |
Drops dot folders only — .gitignore survives |
Repeating and combining¶
-I is repeatable, and | does the same job inside a single pattern. These
are equivalent:
arbol . -I '.*/' -I '__*__/' -I node_modules
arbol . -I '.*/|__*__/|node_modules'
Details that surprise people¶
Each of these is tree's behavior, verified against GNU tree v2.2.1 rather
than assumed:
- Names, not paths.
-I 'src/__pycache__'matches nothing at all. There is no way to scope a pattern to one subtree. - Case-sensitive.
-I 'upper'leavesUPPER/alone.treeneeds--ignore-caseto change that; arbol has no such flag yet. - Negation uses a caret.
[^abc], intree's spelling, not the[!abc]that Python'sfnmatchuses. Arbol accepts thetreeform.
Windows: use python -m arbol for globs¶
Most of the time you will not hit this, because the default rule already hides
dot names and dunder folders and needs no pattern at all. It bites only when
you pass -I with a wildcard in it.
The arbol.exe that uv tool install and pip put on your PATH expands
wildcards before Python runs. A pattern like *.pyc arrives already turned
into the files it matched, and the command fails:
Error: Got unexpected extra argument(s) (main.pyc stale.pyc)
Quoting does not help — not single, not double, not PowerShell's --%, which
passes the quote characters through as literal text and leaves you with a
pattern that silently matches nothing. The expansion happens below the shell.
Run the module through the interpreter instead, which does no expansion:
python -m arbol . -I '*.pyc'
If arbol is installed as a uv tool rather than in the current project:
uv run --with arbol-tree python -m arbol . -I '*.pyc'
Patterns without wildcards are unaffected — there is nothing to expand — so
arbol . -I node_modules works from the console script as usual.
Relationship to the default rule¶
Patterns are applied on top of what is already hidden, and they still apply
when -a is given. So -a -I '.*' is a roundabout way of hiding dot entries
again, and -I is really for what the default does not cover: build output,
vendored trees, and anything else noisy that is not a dot or dunder name.
See the CLI page for what the default hides.