CLI tool to generate directory structures from text files
Project description
txt2dir
Much of my workflow nowadays requires brainstorming and using LLMs to decide on project architecture and file structure. The final output is usually a textfile with a tree diagram for the project skeleton. This tool automates that workflow by turning those textfiles into actual directory structures.
This project also serves as my introduction to the process of turning Python projects into pip packages and working with build tools.
Install
pip install txt2dir
Or install from source:
git clone https://github.com/Sycritz/txt2dir
cd txt2dir
pip install -e .
Usage
txt2dir project_structure.txt -o ~/projects/new_project
Options:
-o, --output: Specify output directory (defaults to current directory)-d, --dry-run: Preview what would be created without actually creating it
Supported Formats
Simple Indented Format
Uses indentation to define hierarchy. Directories end with /, files don't.
myproject/
src/
__init__.py
main.py
utils/
__init__.py
helpers.py
tests/
test_main.py
README.md
requirements.txt
The tool auto-detects indent size (2 spaces, 4 spaces, tabs, etc.) so you don't need to worry about consistency.
Tree Format
Supports the standard tree diagram format with box-drawing characters.
project/
├── README.md
├── src/
│ ├── main.py
│ └── utils/
│ └── helpers.py
└── tests/
└── test_main.py
Both formats can be mixed - use whatever your LLM outputs or whatever you prefer to write by hand.
Features
- Auto-detects indentation size
- Handles both simple and tree diagram formats
- Creates nested directory structures
- Generates empty files with proper paths
- Dry-run mode to preview before creating
- Ignores comment lines (starting with
#)
Examples
Preview structure without creating:
txt2dir structure.txt -d
Create in specific directory:
txt2dir structure.txt -o ~/workspace/new-project
Create in current directory:
txt2dir structure.txt
Notes
Lines starting with # are treated as comments and ignored. Empty lines are also ignored.
Directories must end with / to be recognized as directories. Everything else is treated as a file.
Project details
Release history Release notifications | RSS feed
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 txt2dir-0.1.4.tar.gz.
File metadata
- Download URL: txt2dir-0.1.4.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49e19e7441acca270c10c11bbf9266881800ac4ec96c0551eb0c4bb8f3906f9c
|
|
| MD5 |
b36bfd77eb590b70fad08f771e2b9eae
|
|
| BLAKE2b-256 |
91bb1af09762797491a7d7d0b452182cb750baa37fa8818521df29c7b8f34b1f
|
File details
Details for the file txt2dir-0.1.4-py3-none-any.whl.
File metadata
- Download URL: txt2dir-0.1.4-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a79250f48c1bd322f6b23a7304c07f83d62bcf9515a6320c263d0b6d7ac5a6d
|
|
| MD5 |
2007dd0f87d6f1c51bd1f04bb34a76a3
|
|
| BLAKE2b-256 |
0c22fa219a487f01b5767476bb462d5bde0a715ad09132cb0ee587303cf21306
|