Socket
Socket
Sign inDemoInstall

directory-structure

Package Overview
Dependencies
1
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    directory-structure

Print a directory tree structure in your Python code.


Maintainers
1

Readme

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

Keywords

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc