Skip to main content

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() before create_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


Download files

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

Source Distribution

gpt_folder_tree-0.2.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

gpt_folder_tree-0.2.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

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

Hashes for gpt_folder_tree-0.2.0.tar.gz
Algorithm Hash digest
SHA256 858967240f3d47a05628eadfc20d7e94d9ae058bf9ffd41996d81d37bc85efd7
MD5 12128499b102ee2e437523b1d1d12897
BLAKE2b-256 20b4adf63e19cbeab65d86eae8775deaaaa7d7c16936dd2386361469cc1a5b43

See more details on using hashes here.

File details

Details for the file gpt_folder_tree-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for gpt_folder_tree-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40d2b4a623d3611662ea06ad66819b4165d1f2a3fb34687115ab82ca5070a03f
MD5 420f180adde579bb80a947eb29c3af27
BLAKE2b-256 c9eeb850453c09b5101b88531ec24659043ded3893442b19cf5acf2337e23d8f

See more details on using hashes here.

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