touchtree
touchtree is a lightweight command-line utility that converts raw text directory trees—like those generated by the tree command or produced by AI coding assistants—into real, empty file and folder structures on your file system.
Key Features
- Smart Indentation Parsing: Handles standard spaces, tabs, and ASCII/Unicode box-drawing characters (
├──,└──,│). - Paste-Aware Terminal Input: Paste directly into the terminal without accidental termination from mid-tree blank lines.
- Flexible Termination: Supports standard terminal signals (
Ctrl+D/Ctrl+Z), explicit sentinels (EOF/END), or a deliberate humanEnterkeypress. - Comment Stripping: Inline comments starting with
#are automatically removed before creation. - Safe Dry Runs: Prompts for target directory confirmation before touching the disk.
Quick Start
Installation
pip install touchtree
Example: From AI Prompt to Real Files
1. The Scenario
Suppose an LLM or design spec gives you a desired project structure:
my_awesome_app/
├── src/
│ ├── components/
│ │ ├── Header.py
│ │ └── Sidebar.py # Main navigation component
│ ├── utils/
│ │ └── helpers.py
│ └── main.py
├── tests/
│ └── test_main.py
├── .gitignore
├── pyproject.toml
└── README.md
2. Execution Options
Option A: Interactive Clipboard Paste (Default)
Run touchtree with no arguments, paste the text block, and press [ENTER] on a blank line (or press Ctrl+D / Ctrl+Z):
touchtree
Terminal Walkthrough:
No input file provided. Entering interactive mode.
--> Paste your tree text below.
--> To finish, press [ENTER] on a blank line, type 'EOF', or press [Ctrl+D] / [Ctrl+Z].
--------------------------------------------------
my_awesome_app/
├── src/
│ ├── components/
│ │ ├── Header.py
│ │ └── Sidebar.py # Main navigation component
│ ├── utils/
│ │ └── helpers.py
│ └── main.py
├── tests/
│ └── test_main.py
├── .gitignore
├── pyproject.toml
└── README.md
WARNING: About to generate file structure inside: /path/to/current/dir
Are you sure you want to proceed? (y/N): y
Creating empty replica structure inside: /path/to/current/dir
Structure successfully created.
Option B: Read From a Saved Text File
If you have saved your structure diagram into layout.txt:
touchtree -i layout.txt
Option C: Target a Specific Directory with Auto-Confirm
Create the structure inside a targeted directory (./output) without confirmation prompts:
touchtree -i layout.txt -o ./output -y
Generated Disk Result
Running the command creates the complete nested folder and file hierarchy:
my_awesome_app/
├── .gitignore
├── README.md
├── pyproject.toml
├── src/
│ ├── components/
│ │ ├── Header.py
│ │ └── Sidebar.py
│ ├── main.py
│ └── utils/
│ └── helpers.py
└── tests/
└── test_main.py
- Folders are identified by trailing slashes
/or names lacking extension dots. - Files with extensions or explicit hidden file dots (
.gitignore) are instantiated cleanly via emptytouch()operations. - Comments (like
# Main navigation component) are stripped away during generation.
CLI Options Reference
| Flag | Long Argument | Description | Default |
|---|---|---|---|
-i |
--input |
Path to a text file containing the tree structure. | Interactive Mode |
-o |
--output |
Target root folder where files will be created. | Current Dir (.) |
-y |
--yes |
Skip confirmation prompt and execute immediately. | False |
License
This project is dual-licensed under the MIT License for both code and documentation.
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 touchtree-1.5.7.tar.gz.
File metadata
- Download URL: touchtree-1.5.7.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d217b01a35bcbf83a0395eb8fd73c9d751b7637d6167e531aca3b34511a4c585
|
|
| MD5 |
055389fb494d0738c0207f8427f5d947
|
|
| BLAKE2b-256 |
fbcda6661937cba9469b97bf8708543aa83714ae9eabc2bf908758e4caa230d0
|
File details
Details for the file touchtree-1.5.7-py3-none-any.whl.
File metadata
- Download URL: touchtree-1.5.7-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef8a50fb2907a43ee601906e1d06381e77e9fb75c8097968cd8c2f203e2d7091
|
|
| MD5 |
657c2bd6e747a53e6eeed2e87d7bf00b
|
|
| BLAKE2b-256 |
d3d657cbeeaf5c344d7eb24fea369ef888845f3ecb7b969de5e9d9a91b22846b
|