Jump to content

simulate a tree command using Shell Script that displays all the directories recursively


Recommended Posts

Posted

 

Good day dear Armbian-experts, hello everyone 

 

hope that youre all right and all goes well at your side. 


i want to simulate a tree command using Shell Script that displays all the directories recursively in this format:

.

.
|-- Lorem
|-- Lorem
|-- Lorem
    |-- Lorem
    |-- Lorem
|-- Lorem
`-- Lorem

 

 

how can this be achived?

note: i want to do this on a MX-Linux system - well i can do this with Tree - but wait. I guess that tree has to be installed first..

Posted

1. Not sure what you are trying to do, but tree have a lot of command line options.

 

2. Surely it is open source, go look up sources to study implementation details?

 

27 minutes ago, malaga said:

i want to do this on a MX-Linux system

 

3. This has nothing to do with Armbian, maybe try #linux on libera.chat or (any of the many, many) other general Linux resources on the Internet.

Posted

hello dear TRS-80 

 

first of all - many many thanks for the quick reply.  You were right.

 

This is not focussed on the Armbian - i am sorry that i was posting anything against the forum rules. 

 

Sorry. - i will try to figure it out - and will read some manpages. 

 

Again - sorry for the posting.  I am very glad to be part of this great Community - i am a big big Armbian-Fan. 

 

have  a great day. 

 

 

Posted

find . -type d | awk -F/ '{printf("%"4*NF"s|-- %s\n", " ",$NF)}'

 

(find in current dir all files of type directory and process them threw awk with "/" field separator to print a space with 4 times number of fields width, then a bar and two dash and the last field.

 

awk is your friend

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines