Search code examples
treeoperating-systemdirectorydirectory-structure

Show directory structure of a Python project?


I want to show structure of python project like this.

can I uses some commend like python manage.py [something]...?

ROOT
├── lib
│   ├── django
│   ├── pytz
│   ├── wanttousing_lib
│   └── ...
├── mysite
│   ├── __init__.py
│   ├── settings.py
│   ├── controllers.py
│   ├── models.py
│   ├── views.py
│   ├── templates
│   │   └── like
│   │        ├── index.html
│   │        └── _likehelpers.html
│   └── ....
├── test
│   ├── like
│   │   ├── models_tests.py
│   │   └── controllers_tests.py
│   └── ....
├── static
│   ├── css
│   └── js
├── app.yaml
├── manage.py
├── appengine_config.py
└── requirements.txt

Solution

  • In the Windows command prompt

    cd path/to/ROOT
    tree /f
    

    or if you want to export this tree to a file, use this command

    tree /f > tree.txt
    

    then open tree.txt

    In Linux/MacOS terminal

    First, you should install package name tree

    • In MacOS: brew install tree
    • In RHEL/CentOS/Fedora: yum install tree
    • In Debian/Mint/Ubuntu: sudo apt-get install tree

    Then run this command:

    tree /path/to/ROOT