Buildtree is a lightning-fast CLI tool that creates directory structures from text-based tree diagrams. Perfect for developers, educators, and anyone who needs to quickly materialize directory examples provided by LLMs, documentation, or tutorials.
custom_login/
├── custom_login.info.yml
├── custom_login.services.yml
├── src/
│ ├── Routing/
│ │ └── RouteSubscriber.php
│ └── Controller/
│ └── LoginController.php
→ Converts to actual file structure with one command!
- Instant creation of complex directory structures
- Zero dependencies - single binary
- Supports Windows, macOS, and Linux
- Handles Unicode tree characters (├─, └─, │)
- Automatically detects files vs directories
go install github.com/neomen/buildtree/cmd/buildtree@latest# Using curl
curl -sSL https://github.com/neomen/buildtree/releases/latest/download/install.sh | sh
# Or using wget
wget -q -O - https://github.com/neomen/buildtree/releases/latest/download/install.sh | sh- Download the latest release for your platform from the releases page
- Extract the archive:
tar xzf buildtree_<os>_<arch>.tar.gz
- Move the binary to your PATH:
# Linux/macOS sudo mv buildtree /usr/local/bin/ # Windows # Move buildtree.exe to a directory in your PATH
buildtree "project/
├── src/
│ └── main.go
└── go.mod"Creates:
project/
├── src
│ └── main.go
└── go.mod
pbpaste | buildtree -buildtree -i structure.txtbuildtree "web-app/
├── public/
│ ├── index.html
│ └── assets/
│ ├── style.css
│ └── app.js
├── server/
│ └── main.py
└── README.md"buildtree "docker-project/
├── Dockerfile
├── .dockerignore
├── src/
│ └── app.py
├── requirements.txt
└── config/
└── settings.yaml"Buildtree now includes a powerful feature that allows you to export your entire project structure with file contents to a single file, perfect for providing context to Large Language Models (LLMs).
- Complete project context: Export all files with their paths and contents in a structured format
- Smart filtering: Include only relevant files by extension with
--filter - Size control: Limit file size with
--max-size(default: 100kb) - Ignore patterns: Skip directories like
.gitandnode_modulesby default - Hidden files: Control inclusion of hidden files with
--include-hidden
buildtree -s OUTPUT_FILE [DIRECTORY] [OPTIONS]This example will collect the contents of all files with the *.go, *.txt, *.md extension and combine them into a single file with relative paths.
buildtree -s export-structure.txt ./project-dir -f go,txt,md -I vendor- Quickly test LLM-generated file structures
- Create educational examples for documentation
- Reproduce project layouts during debugging
- Salvage directory structures from corrupted systems
- Automate project scaffolding in CI/CD pipelines
Contributions welcome! Please submit PRs for:
- Improved Unicode handling
- Windows clipboard integration
- Syntax extensions (file content hints)
- More robust error handling
Stop manually creating directories - let BuildTree materialize your file structures with magical speed!