Skip to main content

🌳 tree2dir

PyPI - Version Python Support License

tree2dir is a lightning-fast command-line tool that converts ASCII tree diagrams directly into actual file and folder structures.

Stop manually creating nested directories and files when scaffolding new projects. Just sketch your architecture in a text file, and let tree2dir build the entire structure in seconds.

✨ Features

  • Zero Dependencies: Built entirely with Python's standard library.
  • Smart Detection: Automatically distinguishes between folders and files.
  • Deep Nesting: Accurately calculates indentation to create deeply nested structures.
  • Idempotent: Safe to run multiple times; it won't overwrite existing files with the same name.

📦 Installation

Install easily via pip:

pip install tree2dir

🚀 Usage

1. Create a text file with your diagram (e.g., structure.txt):

Here is an example structure:

my_project/
├── data/
│   ├── raw/
│   └── processed/
├── notebooks/
│   ├── 01_EDA.ipynb
│   └── 02_model_training.ipynb
├── src/
│   ├── knn_classifier.py
│   └── svm_classifier.py
├── models/
├── README.md
└── requirements.txt

2. Run the command:

To generate the structure in your current directory, simply point the tool at your text file:

tree2dir structure.txt

To generate the structure in a specific destination folder, use the -d or --dest flag:

tree2dir structure.txt -d ./my_new_project

🛠️ Development & Contributing

If you want to contribute or modify the tool locally:

  1. Clone the repository.
  2. Install it in editable mode:
    pip install -e .
    
  3. Test your changes using the CLI command tree2dir.

Release files for tree2dir 0.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 tree2dir 0.1.2
File Size Uploaded
tree2dir-0.1.2.tar.gz 3.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tree2dir 0.1.2
File Interpreter ABI Platform
tree2dir-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 7.0 kB

Release files / tree2dir-0.1.2.tar.gz

Download URL tree2dir-0.1.2.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3069f854a2ceed1e3c5c668f30e414c370adf670d069f3ceeb7741f8aac394cf
BLAKE2b-256 checksum
How to use checksums
9e3f0130eae74fa5904d5c723dad5a7a647cb443182f50418805bd989e96ec04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / tree2dir-0.1.2-py3-none-any.whl

Download URL tree2dir-0.1.2-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04aa263b68dc4c8117a8f3a2d754dba4f5a51ee66f896b0e0a78cb7280cea57b
BLAKE2b-256 checksum
How to use checksums
4ae77f89c8df5ba519b526c307ec1dea4be6cf9d9b5cdfd506d02539bba49868
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.0

2 release files

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