Print a directory tree structure in your Python code.

Overview

directory-structure

PyPI PyPI - Downloads PyPI - License GitHub watchers GitHub Repo stars GitHub forks

Print a directory tree structure in your Python code.

Download

You can simply:

pip install directory-structure

Or you can also:

  1. Clone the repository to your local machine.
  2. Enter the directory.
  3. Download necessary modules/libraries.
git clone https://github.com/gabrielstork/directory-structure.git
cd directory-structure
pip install -r requirements.txt

Examples

from directory_structure import Tree

Using absolute path as an argument.

path = Tree('C:/Users/User/Desktop/directory-structure', absolute=True)
print(path)
📂 C:
|_📂 Users
  |_📂 User
    |_📂 Desktop
      |_📂 directory-structure
        |_📁 .git
        |_📁 directory_structure
        |_📄 .gitignore
        |_📄 LICENSE
        |_📄 pyproject.toml
        |_📄 README.md
        |_📄 requirements.txt
        |_📄 setup.py
path = Tree('C:/Users/User/Desktop/directory-structure', absolute=False)
print(path)
📂 directory-structure
|_📁 .git
|_📁 directory_structure
|_📄 .gitignore
|_📄 LICENSE
|_📄 pyproject.toml
|_📄 README.md
|_📄 requirements.txt
|_📄 setup.py

Accessing a folder in current working directory.

path = Tree('./directory_structure', absolute=True)
print(path)
📂 C:
|_📂 Users
  |_📂 User
    |_📂 Desktop
      |_📂 directory-structure
        |_📂 directory_structure
          |_📄 tree.py
          |_📄 __init__.py
path = Tree('./directory_structure', absolute=False)
print(path)
📂 directory_structure
|_📄 tree.py
|_📄 __init__.py

Getting all from the directory where your current working directory is.

path = Tree('../', absolute=True)
print(path)
📂 C:
|_📂 Users
  |_📂 User
    |_📂 Desktop
      |_📁 directory-structure
      |_📄 Discord.lnk
      |_📄 Spotify.lnk
      |_📄 Steam.lnk
      |_📄 Telegram.lnk
      |_📄 Visual Studio Code.lnk
      |_📄 WhatsApp.lnk
path = Tree('../', absolute=False)
print(path)
📂 Desktop
|_📁 directory-structure
|_📄 Discord.lnk
|_📄 Spotify.lnk
|_📄 Steam.lnk
|_📄 Telegram.lnk
|_📄 Visual Studio Code.lnk
|_📄 WhatsApp.lnk

forthebadge forthebadge

You might also like...
Find usage statistics (imports, function calls, attribute access) for Python code-bases

Python Library stats This is a small library that allows you to query some useful statistics for Python code-bases. We currently report library import

This is a Python program to get the source lines of code (SLOC) count for a given GitHub repository.

This is a Python program to get the source lines of code (SLOC) count for a given GitHub repository.

Guesslang detects the programming language of a given source code
Guesslang detects the programming language of a given source code

Detect the programming language of a source code

Learning source code review, spot vulnerability, find some ways how to fix it.

Learn Source Code Review Learning source code review, spot vulnerability, find some ways how to fix it. WordPress Plugin Authenticated Stored XSS on C

An app to show the total number of lines of code written by an user.

Lines of code Have you ever wondered how many lines of code you wrote in github? This tool will calculate it for you! To calculate the total number of

Metrinome is an all-purpose tool for working with code complexity metrics.
Metrinome is an all-purpose tool for working with code complexity metrics.

Overview Metrinome is an all-purpose tool for working with code complexity metrics. It can be used as both a REPL and API, and includes: Converters to

A simple stopwatch for measuring code performance with static typing.

A simple stopwatch for measuring code performance. This is a fork from python-stopwatch, which adds static typing and a few other things.

pycallgraph is a Python module that creates call graphs for Python programs.
pycallgraph is a Python module that creates call graphs for Python programs.

Project Abandoned Many apologies. I've stopped maintaining this project due to personal time constraints. Blog post with more information. I'm happy t

Inspects Python source files and provides information about type and location of classes, methods etc

prospector About Prospector is a tool to analyse Python code and output information about errors, potential problems, convention violations and comple

Owner
Gabriel Stork
Python
Gabriel Stork
A very minimalistic python module that lets you track the time your code snippets take to run.

Clock Keeper A very minimalistic python module that lets you track the time your code snippets take to run. This package is available on PyPI! Run the

Rajdeep Biswas 1 Jan 19, 2022
coala provides a unified command-line interface for linting and fixing all your code, regardless of the programming languages you use.

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." ― John F. Woods coala provides a

coala development group 3.4k Jan 2, 2023
Robocop is a tool that performs static code analysis of Robot Framework code.

Robocop Introduction Documentation Values Requirements Installation Usage Example Robotidy FAQ Watch our talk from RoboCon 2021 about Robocop and Robo

marketsquare 132 Dec 29, 2022
CodeAnalysis - Static Code Analysis: a code comprehensive analysis platform

TCA, Tencent Cloud Code Analysis English | 简体中文 What is TCA Tencent Cloud Code A

Tencent 1.3k Jan 7, 2023
Alarmer is a tool focus on error reporting for your application.

alarmer Alarmer is a tool focus on error reporting for your application. Installation pip install alarmer Usage It's simple to integrate alarmer in yo

long2ice 20 Jul 3, 2022
Find dead Python code

Vulture - Find dead code Vulture finds unused code in Python programs. This is useful for cleaning up and finding errors in large code bases. If you r

Jendrik Seipp 2.4k Jan 3, 2023
Code audit tool for python.

Pylama Code audit tool for Python and JavaScript. Pylama wraps these tools: pycodestyle (formerly pep8) © 2012-2013, Florent Xicluna; pydocstyle (form

Kirill Klenov 966 Dec 29, 2022
The uncompromising Python code formatter

The Uncompromising Code Formatter “Any color you like.” Black is the uncompromising Python code formatter. By using it, you agree to cede control over

Python Software Foundation 30.7k Dec 28, 2022
A static type analyzer for Python code

pytype - ? ✔ Pytype checks and infers types for your Python code - without requiring type annotations. Pytype can: Lint plain Python code, flagging c

Google 4k Dec 31, 2022
Python package to parse and generate C/C++ code as context aware preprocessor.

Devana Devana is a python tool that make it easy to parsing, format, transform and generate C++ (or C) code. This tool uses libclang to parse the code

null 5 Dec 28, 2022