Convert text-based directory structures into actual folders and files instantly!
simple_structure_builder.py- Simple, easy-to-use script (recommended)structure_builder.py- Feature-rich version with advanced parsingbatch_structure_builder.py- Batch processing with templates
python simple_structure_builder.pyThen paste your structure and type END:
myproject/
src/
main.py
utils.py
tests/
test_main.py
README.md
END
# List available templates
python batch_structure_builder.py --list-templates
# Create Django SaaS structure
python batch_structure_builder.py --template django-saas
# Create FastAPI structure
python batch_structure_builder.py --template fastapi# Create structure from a text file
python batch_structure_builder.py structure.txtThe scripts support multiple format styles:
myproject/
app/
models.py
views.py
static/
css/
style.css
README.md
myproject/
├── app/
│ ├── models.py
│ └── views.py
├── static/
│ └── css/
│ └── style.css
└── README.md
myproject/
app/ # Main application
models.py # Database models
views.py # Views/controllers
README.md # Project documentation
- Smart Detection: Automatically detects files (with extensions) vs directories
- Python Support: Auto-creates
__init__.pyin Python packages - Template Content: Adds basic content to common file types
- Tree Parsing: Handles various tree-drawing formats
- Preview Mode: Shows what will be created before doing it
- Batch Creation: Create multiple projects at once
- Built-in Templates: Django, FastAPI, Flask, React, and more
Files are detected if they have:
- Extensions (
.py,.js,.html,.css, etc.) - Common names:
README,LICENSE,Makefile,Dockerfile,manage.py
Everything else is treated as a directory.
python simple_structure_builder.pyPaste:
myproject/
manage.py
requirements.txt
myproject/
settings.py
urls.py
wsgi.py
apps/
core/
models.py
views.py
urls.py
static/
css/
js/
templates/
END
python batch_structure_builder.py --template django-saas --output ~/projects/myappSave this as structure.txt:
onehux-ai/
manage.py
requirements.txt
core/
models.py
views.py
urls.py
templates/
core/
base.html
accounts/
models.py
views.py
static/
css/
js/
Then run:
python batch_structure_builder.py structure.txtCreate batch.txt:
Project1:
src/
main.py
tests/
test_main.py
Project2:
app/
index.js
public/
index.html
Run:
python batch_structure_builder.py batch.txt --batchpython simple_structure_builder.py
# Interactive mode only# From file
python batch_structure_builder.py structure.txt
# Use template
python batch_structure_builder.py --template django-saas
# Custom output directory
python batch_structure_builder.py --template fastapi --output ~/myproject
# List all templates
python batch_structure_builder.py --list-templates
# Batch mode
python batch_structure_builder.py batch.txt --batchdjango-basic- Basic Django projectdjango-saas- Full Django SaaS structure (like your onehux-ai)fastapi- FastAPI project with API structureflask- Flask applicationreact- React frontend projectpython-package- Python package with tests and docs
Files are created with basic content:
| File Type | Content |
|---|---|
.py |
Empty (ready for code) |
.html |
Basic HTML5 template |
.md |
Markdown heading |
.json |
Empty JSON object |
.gitignore |
Common Python ignores |
.env |
Empty with comment |
You can also use it programmatically:
from simple_structure_builder import create_from_text
structure = '''
myproject/
src/
main.py
README.md
'''
stats = create_from_text(structure, base_path='./output')
print(f"Created {stats['dirs']} directories and {stats['files']} files")When prompted, answer 'n' to skip automatic __init__.py creation:
❓ Auto-create __init__.py? (y/n): n
The script always shows a preview. Review it before confirming!
# Relative path
python batch_structure_builder.py --template django-saas --output ./myapp
# Absolute path
python batch_structure_builder.py --template django-saas --output ~/projects/myappYou can paste output directly from the tree command:
tree myexisting project > structure.txt
# Edit structure.txt to remove unwanted files
python batch_structure_builder.py structure.txtEdit batch_structure_builder.py and add to the TEMPLATES dict:
TEMPLATES = {
'my-custom-template': '''
myproject/
src/
main.py
README.md
''',
}Solution: Make sure files have extensions (.py, .js, etc.)
Solution: Use consistent indentation (all spaces or all tabs)
Solution: Make sure you have Python 3.6+
python --version
# or
python3 simple_structure_builder.pySolution: Run with appropriate permissions or create in a writable directory
Let's recreate your onehux-ai structure:
python simple_structure_builder.pyPaste the structure from your document and type END. The script will:
- Show you a preview
- Ask for confirmation
- Create all folders and files
- Auto-generate
__init__.pyin Python packages - Show a summary of what was created
Feel free to modify these scripts for your needs! They're designed to be simple and hackable.
Free to use and modify!
Made with ❤️ for developers who hate manual folder creation