Skip to content
/ mks Public

a lightweight, cross-platform CLI tool that reads a directory structure in **tree format** (from clipboard or file) and automatically creates the corresponding folders and files.

Notifications You must be signed in to change notification settings

cumulus13/mks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mks – Create Directory Structures from Tree-like Text

mks is a lightweight, cross-platform CLI tool that reads a directory structure in tree format (from clipboard or file) and automatically creates the corresponding folders and files.

Perfect for quickly scaffolding projects from shared diagrams, documentation, or terminal output.


🎦 Demo

✅ Features

  • Input from clipboard or text file
  • Supports Unix-style tree output (with ├──, └──, )
  • Also supports simple indented format using spaces or tabs
  • Windows-safe: validates file/folder names (blocks CON, NUL, invalid chars)
  • Creates empty files and nested directories as specified
  • Fast, dependency-light, and compiles to a single executable

🚀 Quick Start

0. Install

cargo install mks

✅ Format A: Simple Indent (Recommended)

Use spaces or tabs for nesting (no special symbols needed):

my-app/
    package.json
    src/
        index.js
        utils/
            helper.js
    public/
        style.css

✅ Format B: tree Output (Unix-style)

Copy directly from tree command in Git Bash, WSL, or Linux/macOS:

my-app/
├── package.json
├── src/
│   ├── index.js
│   └── utils/
│       └── helper.js
└── public/
    └── style.css

3. Run mks

From a file:

mks structure.txt

From clipboard:

# Copy your tree text, then run:
mks

✅ Output:

Read from file (7 lines)
✅ Creating structure...
✅ Done!

📁 Output Example

Given this input:

blog/
    posts/
        first.md
    config.yaml

mks will create:

blog/
├── config.yaml
└── posts/
    └── first.md

All files are empty (0 bytes) — ideal for scaffolding.


⚠️ Limitations & Notes

  • Windows reserved names (CON, PRN, AUX, NUL, COM1, LPT1, etc.) are blocked.
  • Filenames cannot contain: < > : " / \ | ? *
  • Filenames cannot end with space or dot (.)
  • Maximum filename length: 255 characters
  • On Linux, ensure xclip or xsel is installed for clipboard support:
    sudo apt install xclip    # Debian/Ubuntu

🔒 Safety First

mks never overwrites existing files.
If a file or folder already exists, it is skipped silently (no error).

To start fresh, run mks in an empty directory.


🛠️ Build Your Own

cargo build --release  # As per your preference for executable name
cp target/release/mks /usr/local/bin

The tool uses the MIT License — free to use, modify, and distribute.


💡 Pro Tips

  • Use Git Bash on Windows to generate valid tree output:
    tree my-project
  • Prefer space-indented format if sharing across teams — it’s more portable.
  • Combine with templates: generate structure → fill files later.

🙌 Author

Hadi Cahyadi

Buy Me a Coffee

Donate via Ko-fi

Support me on Patreon


“Scaffold fast, code faster.” — mks

About

a lightweight, cross-platform CLI tool that reads a directory structure in **tree format** (from clipboard or file) and automatically creates the corresponding folders and files.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages