1

tree shows

...
│   ├── template_one_file.sh
│   ├── template_sed.sh
│   ├── testy.sh
│   ├── tmp
│   │   ├── file1.html.13567_old
│   │   ├── file2.html.13567_old
│   │   ├── file3.html.13567_old
│   │   └── file4.html.13567_old
│   └── use_case_to_add_etc_2_numbers
└── vi
    ├── vim_tips_and_chearsheet
    └── vi_stuff

160 directories, 713 files

and I can ignore the tmp directory (for example) with tree -I 'tmp' -L 4

...
│   ├── template_multiple_files.sh
│   ├── template_one_file.sh
│   ├── template_sed.sh
│   ├── testy.sh
│   └── use_case_to_add_etc_2_numbers
└── vi
    ├── vim_tips_and_chearsheet
    └── vi_stuff

157 directories, 709 files

but why can I not ignore individual files such as the _old files with

tree -I 'old' -L 4

which still shows the _old files

...
│   ├── template_multiple_files.sh
│   ├── template_one_file.sh
│   ├── template_sed.sh
│   ├── testy.sh
│   ├── tmp
│   │   ├── file1.html.13567_old
│   │   ├── file2.html.13567_old
│   │   ├── file3.html.13567_old
│   │   └── file4.html.13567_old
│   └── use_case_to_add_etc_2_numbers
└── vi
    ├── vim_tips_and_chearsheet
    └── vi_stuff

160 directories, 713 files

I tried '.*old' and '.*old$' patterns but that didn't help.

1 Answers1

5

Use a wildcard:

tree -I '*_old' -L 4

Reference: man tree (my emphasis)

-I pattern

Do not list those files that match the wild-card pattern.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255