Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‘ baa-strap

A tiny script that turns a text tree into real folders and files β€” demonstrated on the most important project of all: counting sheep before bed.

What this actually is

create_structure.py reads a plain-text folder tree (the kind tree outputs, or the kind you'd sketch by hand) and builds the real folders and files from it, right in your project root.

python create_structure.py structure.txt .

It understands both common tree styles:

Unicode (β”œβ”€β”€, └──, β”‚) β€” what you get from tree on Linux/macOS, or what most people type by hand:

project/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.py
β”‚   └── utils/
β”‚       └── helpers.py
β”œβ”€β”€ tests/
β”‚   └── test_main.py
β”œβ”€β”€ requirements.txt
└── README.md

Windows ASCII (+---, \---, |) β€” the output of tree /F on Windows:

+---src
|   |   main.py
|   |
|   \---utils
|           helpers.py
+---tests
|       test_main.py
|
|   requirements.txt
\---README.md

Both formats work as-is β€” no need to convert one into the other, just point the script at whichever one you've got.

It figures out files vs. folders automatically (trailing /, or by checking whether anything is nested underneath), and it's idempotent β€” rerun it and it won't clobber files that already exist.

The demo

structure.txt in this repo is just an example input β€” a made-up project structure for a fictional app that counts sheep before you fall asleep (flock/, sleep/, a dream_log.json, the works). It's not a real project; it's here purely to show the script working on something more fun than src/, tests/, README.md.

Swap it out for your own structure.txt and it'll scaffold your project instead β€” that's the whole point.

# try the demo
python create_structure.py structure.txt ./demo-output

# use it for real
python create_structure.py my-project-structure.txt .

Usage

python create_structure.py <structure_file> [target_dir]
Argument Description
structure_file Path to a text file describing the tree
target_dir Where to build it (defaults to current directory)

Files in this repo

File Purpose
create_structure.py The actual tool
structure.txt Example/demo input (the sheep-counting project πŸ‘)
README.md This file

License

MIT β€” see LICENSE.

About

A script that turns a plain-text tree into real folders and files β€” demonstrated on the most important project of all: counting sheep before bed. πŸ‘

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages