Is there anyway to get tree
to behave such that, when it is run with the -P
option, it will not output directories that don't have files matching the pattern somewhere inside of them?
As an example, take this directory structure:
${DIRECTORY}/
runtime/
runtime_library.so
runtime_library.a
my_libraries/
drawing/
drawing.so
basic_functions/
basic.a
documents/
manual.txt
empty/
I'd like to get tree
to output this:
${DIRECTORY}/
my_libraries/
basic_functions/
basic.a
runtime/
runtime_library.a
tree
v1.7.0 (on fedora 23) has an option--prune
to not show directories that have no matching files. – meuh May 20 '17 at 08:53--prune
, all files are listed in blue and only matching ones in red, not very helpful. – WesternGun Mar 15 '24 at 09:57