Is anyone aware of a 'tree' tool that supports wildcards?

For example, I would like to see all .h and .cpp files in a 'tree' output.

I don't want to use dir /s *.h *.cpp etc - I want to see a tree, not a list of paths.

up vote 1 down vote accepted

Found here https://stackoverflow.com/questions/11004731/output-of-tree-in-command-prompt

tree /f /a | findstr /ri /c:"^[^| ]" /c:"^[| ]*[+\\]" /c:"\.h$"
  • How would you rewrite that line to list *.c *.cpp *.h and *.hpp files? – SparkyNZ Feb 8 at 3:25
  • 1
    tree /f /a | findstr /ri /c:"^[^| ]" /c:"^[| ]*[+\\]" /c:"\.[ch]p*$" worked for me, depends how many file extensions you want to add – Possum Feb 8 at 10:30

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.