Skip to main content

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

Metadata

Release files for directory-structure 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for directory-structure 1.1.2
File Size Uploaded Provenance Actions
directory-structure-1.1.2.tar.gz 4.0 kB Without provenance Details for directory-structure-1.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for directory-structure 1.1.2
File Interpreter ABI Platform Actions
directory_structure-1.1.2-py3-none-any.whl Python 3 none any Details for directory_structure-1.1.2-py3-none-any.whl

Total release size: 8.4 kB

Release files / directory-structure-1.1.2.tar.gz

Download URL directory-structure-1.1.2.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e43f579c2dc41b8f5d814d43b38abf51c169c0e1bcbbc84faef477d747e079b0
BLAKE2b-256 checksum
How to use checksums
b01021c893bfa9dd302e0b8fcb23f17efbf20f0cfbbb3b84b37e4d15c66aa3d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

Release files / directory_structure-1.1.2-py3-none-any.whl

Download URL directory_structure-1.1.2-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce053f71e8ab2aaf77a88e26ca3e729acf6ecf828b43db0eeac3858ae62dd259
BLAKE2b-256 checksum
How to use checksums
692498f287bc87651187d030caa579e3d91cb48b73bb103f3b3a4cb8eed2074f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

Security for directory-structure 1.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page