Python Forum
a tree command using Shell Script that displays all the directories recursively
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a tree command using Shell Script that displays all the directories recursively
#1
Good day dear Python-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..
Wordpress - super toolkits a. http://wpgear.org/ :: und b. https://github.com/miziomon/awesome-wordpress :: Awesome WordPress: A curated list of amazingly awesome WordPress resources and awesome python things https://github.com/vinta/awesome-python
Reply
#2
Here's one that's pretty close.

#!/usr/bin/env bash

# bash script to generate tree structure of a directory
# Pravendra Singh : https://pravj.github.io

pwd=$(pwd)
find $pwd -print | sed -e "s;$pwd;\.;g;s;[^/]*\/;|__;g;s;__|; |;g"
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  script wanted: print the command Skaperen 5 2,489 Dec-12-2017, 12:02 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020