Convert an AI-generated tree structure into real files & directories.
β Parses tree format from AI output (e.g., ChatGPT, Copilot). β Creates files & folders without overwriting existing files. β Optionally skips the root folder (perfect for pre-existing repos).
Clone this repo and move the script somewhere in your $PATH:
git clone https://github.com/bline/tree2files.git
cd tree2files
chmod +x tree2files
mv tree2files ~/.local/bin/ # Or /usr/local/bin/ for global usage-
Save your AI-generated project structure in
structure.txt:myproject/ βββ Cargo.toml βββ package.json βββ src/ β βββ lib.rs β βββ ts/ β βββ index.ts β βββ validator.ts β βββ types.ts βββ examples/ β βββ browser.html β βββ node.js βββ tests/ βββ validator.test.ts βββ schemas/ -
Run:
tree2files structure.txt
This creates the full directory structure.
-
If you already cloned a Git repo and want files inside it:
tree2files structure.txt --strip-root
-
Open in VS Code:
code .
- Saves time: No need to manually create files after AI-generated output.
- Safe: Doesn't overwrite existing files.
- Lightweight: No dependencies, just a single script!
MIT License. Contributions welcome!