Skip to main content

Generate and export directory tree structures with optional color output.

Project description

Directory Tree Script

This script generates a visual representation of the directory structure of a specified root directory. It supports exporting the structure to a Markdown file and offers various options to customize the output.

Example Output

├── .env
├── .gitignore
├── README.md
├── config/
│   ├── env.go
├── data/
│   ├── found-url.json
│   ├── url.txt
├── db/
│   ├── db.go
├── directory_structure.md
├── go.mod
├── go.sum
├── main.go
├── rss/
│   ├── fetch.go
├── telegram/
│   ├── telegram.go
├── utils/
    ├── http.go
    ├── utils.go

Features

  • Visual Directory Tree: Display the directory structure in a tree-like format.
  • Export to Markdown: Save the directory structure to a Markdown file for documentation purposes.
  • Depth Limiting: Limit the depth of directory traversal to avoid overwhelming outputs for deep directory structures.
  • Colorful Output: Colorize the terminal output to differentiate directories from files.

Installation

 pip install tree-scribe
 pipx install tree-scribe

Command-Line Switches

Switch/Option Description Example Usage
<directory-path> Path to the root directory whose structure you want to display. tree-scribe /home/project
-md, --export-md Export the directory structure to a Markdown file. tree-scribe /home/project -md
-d, --depth <number> Limit the depth of directory traversal. tree-scribe /home/project -d 2
-v, --verbose Enable verbose logging for detailed output. tree-scribe /home/project -v
-c, --color Enable colorful output in the terminal. tree-scribe /home/project -c

Examples

  1. Display the Directory Structure

    tree-scribe /home/project
    
  2. Export to Markdown

    tree-scribe /home/project --export-md
    
  3. Limit Depth to 2 Levels

    tree-scribe /home/project --depth 2
    
  4. Enable Verbose Logging

    tree-scribe /home/project --verbose
    
  5. Enable Colorful Output

    tree-scribe /home/project -c
    
  6. Combine Options

    tree-scribe /home/project --export-md --depth 3 -c
    

Notes

  • Colorful Output: The -c or --color switch enables colorful terminal output using colorama. Without this switch, the output will be plain text.
  • Depth Limiting: Use the --depth option to control how many levels deep the directory tree should be displayed.
  • Verbose Mode: The --verbose option provides more detailed logging information during script execution.
  • Markdown Export: The --export-md option saves the directory structure to a Markdown file for documentation purposes.

For any additional options or troubleshooting, please refer to the Troubleshooting section of this documentation.

Troubleshooting

  • Permission Errors: If you encounter permission errors, make sure you have the necessary permissions to access the directories and files.
  • Invalid Directory Path: Ensure the specified directory path is correct and exists.

License

This script is provided under the MIT License. See the LICENSE file for more information.

Contributing

Feel free to submit issues, suggestions, or pull requests. Contributions are welcome!

Summary of Additions
  • Customizing Filters: Instructions for modifying the filters.py file to include or exclude specific directories from the output.
  • Adding/Removing Folders: Clear steps on how to update the EXCLUDED_DIRECTORIES list.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tree_scribe-0.0.4.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tree_scribe-0.0.4-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file tree_scribe-0.0.4.tar.gz.

File metadata

  • Download URL: tree_scribe-0.0.4.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for tree_scribe-0.0.4.tar.gz
Algorithm Hash digest
SHA256 957053c33463d8c0ea76b9816dfabc0d17a6d1d128d34df891eab5f1a4d3dea6
MD5 21d820d83d546033160e389bcbef5ac3
BLAKE2b-256 02b0835f0cd54441f7926456dcf67bf61b8282f6071650bf5baeecadafa8ca67

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_scribe-0.0.4.tar.gz:

Publisher: main.yml on mamad-1999/tree-scribe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_scribe-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: tree_scribe-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for tree_scribe-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a3ce39a2f4c2b70b8b6671a94301495aec0e7e14afb326a06bf01a2749123ee0
MD5 cf944eebe8d88f481972bd41250ace9c
BLAKE2b-256 8cd41828f698ba3e1878fbb27019055f65de6ce1c1d7a852fe52ad5f74dced4c

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_scribe-0.0.4-py3-none-any.whl:

Publisher: main.yml on mamad-1999/tree-scribe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page