Generate real folder and file structures from GPT-style ASCII trees
Project description
gpt-folder-tree
Create complete project folder structures from GPT-style ASCII trees โ instantly.
gpt-folder-tree is a lightweight Python utility that converts ASCII folder trees (like those generated by ChatGPT or written in README files) into real directories and files on your filesystem.
Perfect for:
- Bootstrapping new projects
- Recreating documented folder structures
- Automating scaffolding for frameworks, microservices, or libraries
- Turning design docs into real codebases
โจ Features
- ๐ Parse GPT / Unix-style ASCII folder trees
- ๐งช Dry-run mode to preview what will be created
- โก Create folders and files automatically
- ๐งฉ Minimal, dependency-free, and fast
- ๐ Pythonic API โ easy to integrate into tools or CLIs
๐ฆ Installation
# Install using pip
pip install gpt-folder-tree
# Install using uv
uv add gpt-folder-tree
๐ Quick Start
1. Import the library
from gpt_folder_tree import parse_tree, create_tree, dry_run
2. Define your folder structure (ASCII format)
gpt_ascii_text = """
project/
โโโ app/
โ โโโ __init__.py
โ โโโ main.py
โ โโโ config.py
โ โโโ database/
โ โ โโโ __init__.py
โ โ โโโ connection.py
โ โ โโโ models.py
โ โโโ api/
โ โ โโโ __init__.py
โ โ โโโ v1/
โ โ โ โโโ __init__.py
โ โ โ โโโ routes.py
โ โ โ โโโ schemas.py
โ โโโ services/
โ โ โโโ __init__.py
โ โ โโโ auth_service.py
โ โ โโโ user_service.py
โ โ โโโ email_service.py
โ โโโ core/
โ โ โโโ __init__.py
โ โ โโโ security.py
โ โ โโโ dependencies.py
โ โโโ utils/
โ โ โโโ __init__.py
โ โ โโโ helpers.py
โโโ tests/
โ โโโ __init__.py
โ โโโ test_main.py
โ โโโ test_auth.py
โ โโโ test_users.py
โโโ alembic/
โ โโโ env.py
โ โโโ versions/
โโโ scripts/
โ โโโ seed_db.py
โโโ requirements.txt
โโโ .env
โโโ README.md
โโโ Dockerfile
"""
3. Parse the tree
tree = parse_tree(gpt_ascii_text)
4. (Optional) Dry run โ preview what will be created
dry_run(tree)
Output example:
CREATE DIR ./project
CREATE DIR ./project/app
CREATE FILE ./project/app/main.py
...
5. Create the folders & files
create_tree(tree)
โ Your entire project structure is now created on disk.
๐ง How It Works
- Directories are detected by a trailing
/ - Files are created as empty files
- Indentation depth determines parent-child relationships
- Compatible with GPT-generated trees and Unix-style layouts
๐ API Reference
parse_tree(text: str) -> Node
Parses an ASCII tree string into an internal tree structure.
dry_run(node: Node, base_path: str = ".")
Prints what would be created without touching the filesystem.
create_tree(node: Node, base_path: str = ".")
Creates all directories and files on disk.
โ ๏ธ Notes & Best Practices
- Run
dry_run()beforecreate_tree()for safety - Avoid running in sensitive directories (e.g.,
/, home root) - ASCII tree must be properly indented (4 spaces per level)
๐ค Contributing
Contributions, issues, and feature requests are welcome. This project is intentionally simple โ clarity over complexity.
โญ Why This Exists
Because copying folder structures from ChatGPT, README files, or documentation should not require manual folder creation.
Turn ideas into structure. Instantly.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gpt_folder_tree-0.2.0.tar.gz.
File metadata
- Download URL: gpt_folder_tree-0.2.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
858967240f3d47a05628eadfc20d7e94d9ae058bf9ffd41996d81d37bc85efd7
|
|
| MD5 |
12128499b102ee2e437523b1d1d12897
|
|
| BLAKE2b-256 |
20b4adf63e19cbeab65d86eae8775deaaaa7d7c16936dd2386361469cc1a5b43
|
File details
Details for the file gpt_folder_tree-0.2.0-py3-none-any.whl.
File metadata
- Download URL: gpt_folder_tree-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40d2b4a623d3611662ea06ad66819b4165d1f2a3fb34687115ab82ca5070a03f
|
|
| MD5 |
420f180adde579bb80a947eb29c3af27
|
|
| BLAKE2b-256 |
c9eeb850453c09b5101b88531ec24659043ded3893442b19cf5acf2337e23d8f
|