2

Say I have a directory structure that looks like this:

foo
|-- bar
|   |-- 1
|   |-- 2
|   |-- 3
|   |-- baz
|   |   |-- 4
|   |   |-- 5
|   |   |-- 6
|   |   |-- moo
|   |   |   |-- 7
|   |   |   |-- 8
|   |   |   |-- 9
|   |   |   `-- mar
|   |   |       `-- maz
|   |   `-- moo2
|   `-- baz2
`-- bar2

I know that I can use tree -C foo to colour the output, so that folders appear in a certain colour, etc, like so:

enter image description here

However, another feature that would be very much nice to have is the ability to provide colour to the heading lines. Such that each level of indentation would have its own colour. E.g. the first level is red, the second level is green, the third level is blue, and so on. This would make it easier to distinguish heading levels when reading a long tree.

I've contrived half of a mock-up example to show what I mean:

enter image description here

Is there any tool or program which does this?

terdon
  • 242,166
Lou
  • 205
  • @terdon RHE7, but yes as indicated I am already aware of tree -C. That solves a different problem, which is colouring the file/directory names. I would like to be able to colour the bars or characters which connect to each file/directory, according to their level of indentation. I could probably write a script to do this and pipe tree into it, but wanted to know if anyone had already invented that particular wheel. – Lou Jan 04 '23 at 15:02
  • 1
    Yes, sorry, my bad. I thought the image was an example of what you would like and didn't see that you had clearly written it was tree -C. Sorry! – terdon Jan 04 '23 at 15:16

0 Answers0