Ignore multiple folders using tree

5

1

The command tree -I 'node_modules' prevents the node_modules folder from appearing in the output. Likewise, tree -I 'app/ui/bower_components' prevents app/ui/bower_components from appearing in the output.

However, tree -I 'node_modules' -I 'app/ui/bower_components' doesn't prevent both from appearing in the output. Instead, it appears the last one is used.

So, how do you ignore multiple folders using tree?

Jon

Posted 2015-08-20T08:21:00.117

Reputation: 253

Answers

7

You can use | to separate patterns, in your example you can do

tree -I "node_modules|bower_components"

You need the double quotation marks so that bash won't interpret the pipe character.

If you look at the man pages for tree, read the one for the -P argument instead of the -I (just above).

Marlun

Posted 2015-08-20T08:21:00.117

Reputation: 243