Skip to main content

touchtree

PyPI version License: MIT Python Version

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 human Enter keypress.
  • 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 empty touch() 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.

Metadata

Release files for touchtree 1.5.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for touchtree 1.5.7
File Size Uploaded Provenance
touchtree-1.5.7.tar.gz 7.7 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 15.6 kB

Release files / touchtree-1.5.7.tar.gz

Download URL touchtree-1.5.7.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d217b01a35bcbf83a0395eb8fd73c9d751b7637d6167e531aca3b34511a4c585
BLAKE2b-256 checksum
How to use checksums
fbcda6661937cba9469b97bf8708543aa83714ae9eabc2bf908758e4caa230d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.13

Release files / touchtree-1.5.7-py3-none-any.whl

Download URL touchtree-1.5.7-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef8a50fb2907a43ee601906e1d06381e77e9fb75c8097968cd8c2f203e2d7091
BLAKE2b-256 checksum
How to use checksums
d3d657cbeeaf5c344d7eb24fea369ef888845f3ecb7b969de5e9d9a91b22846b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.13

Security for touchtree 1.5.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.5.7 This release

2 release files No provenance

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