18

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
  • 435

1 Answers1

22

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
  • 428