Skip to main content

foldertree

A Python tool to generate folder structures from tree-like format.

Features

  • Multiple Input Formats: Supports tree-like structures, YAML, and simple indentation
  • Auto-detection: Automatically detects input format
  • Comment Support: Adds comments to generated files based on file extensions
  • Python Package Detection: Automatically creates __init__.py files in Python packages
  • Smart Skipping: Skips common files like __pycache__, .git, etc.
  • Dry Run Mode: Preview what will be created without actual file creation
  • Flexible Output: Specify custom output directories

Installation

git clone https://github.com/sree-sphere/foldertree.git
cd foldertree
pip install -e .

Usage

Command Line

# From file
foldertree -f structure.tree

# From stdin
echo "api/
  routes.py
core/
  classifier.py" | foldertree

# Dry run (preview only)
foldertree -f structure.tree --dry-run

# Specify output directory
foldertree -f structure.tree -o project_output

# Force specific format
foldertree -f structure.yaml --format yaml

Python

from foldertree import TreeParser, TreeGenerator

# Parse structure
parser = TreeParser()
tree = parser.parse("""
api/
  routes.py    # FastAPI endpoints
core/
  classifier.py  # ML model
""")

# Generate structure
generator = TreeGenerator("./output")
result = generator.generate(tree)
print(f"Created {len(result['created_files'])} files")

Input Formats

  • Tree Format (with symbols)
├── api/
│   ├── __init__.py
│   └── routes.py
├── core/
│   ├── __init__.py
│   └── classifier.py
├── data/
│   ├── chunks_head/
│   └── highlight.json
└── main.py
  • Simple Indentation
api/
  routes.py                  # FastAPI endpoints
core/
  classifier.py              # ML model
main.py
  • YAML Format
structure:
  api:
    - routes.py
    - __init__.py
  core:
    - classifier.py
    - __init__.py
  main.py: null

Comment Support

The tool automatically adds appropriate comments to files based on their extensions:

  • .py files: # Comment
  • .js/.ts files: // Comment
  • .css files: /* Comment */
  • .html/.xml files:
  • And many more...

Smart Features

Automatic __init__.py Creation

When directories contain .py files, __init__.py is automatically created to make them proper Python packages.

Intelligent Skipping

Automatically skips common files and directories:

  • __pycache__
  • .git
  • node_modules
  • .env
  • Build/dist directories
  • And more...

Options

  • -f, --file: Input file containing folder structure
  • -o, --output: Output directory (default: current directory)
  • --format: Force input format (tree, yaml, simple, auto)
  • --dry-run: Show what would be created without creating files
  • -v, --verbose: Verbose output
  • --version: Show version

Metadata

Release files for treescaffold 1.3.1

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

Source distribution (sdist)

Source distribution for treescaffold 1.3.1
File Size Uploaded Provenance Actions
treescaffold-1.3.1.tar.gz 14.0 kB Without provenance Details for treescaffold-1.3.1.tar.gz

Built distribution (wheel)

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

Total release size: 22.9 kB

Release files / treescaffold-1.3.1.tar.gz

Download URL treescaffold-1.3.1.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9a48dac59e5853a721e5f55d162ba657de62bf4a91172d730913bd6c37e94b31
BLAKE2b-256 checksum
How to use checksums
7f052f505d9e8dc4069f6c70a11c4d5ccec2ab6fe9d55aac1eeaf5ebf4ed269c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release files / treescaffold-1.3.1-py3-none-any.whl

Download URL treescaffold-1.3.1-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30ed60da9d2351ab7f0bd073b4e0e92e63faadfc559fe48d6437b0fa4ca7d60f
BLAKE2b-256 checksum
How to use checksums
68afc5f168f538f5c152f15026d31a5233a926213ce06a458d5d0c83685fd263
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Security for treescaffold 1.3.1

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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