mkdir-rs 1.0.4

A robust, production-ready mkdir replacement with brace expansion for Windows
mkdir-rs-1.0.4 is not a library.

README.md

mkdir-rs: Robust mkdir for Windows with Brace Expansion

A production-ready Rust replacement for mkdir on Windows that supports Linux-style brace expansion patterns.

Features

  • 🔧 Full Brace Expansion: {a,b,c} syntax with nested support
  • 📁 Recursive Creation: Create deep directory trees in one command
  • 🚀 Production Ready: Comprehensive error handling, logging, and edge cases
  • 🎯 Cross-Platform: Works on Windows, Linux, and macOS (primary focus: Windows)
  • 🔒 Safe Operations: No silent failures, proper error reporting
  • ⚡ High Performance: Compiled, optimized Rust binary

Installation

From Crates.io

cargo install mkdir-rs

From Source

git clone https://github.com/cumulus13/mkdir-rs
cd mkdir-rs
cargo build --release

The binary will be at target/release/mkdir-rs.exe (Windows) or target/release/mkdir-rs (Unix). you can rename to mkdir.exe and copy to anywhere as you want (c:\Windows\System32, etc)

Add to PATH

Copy the binary to a location in your PATH, or add the release directory to your PATH.

Usage

Basic Examples

# Simple brace expansion
mkdir-rs dir1/{dir2,dir3,dir4}
# Creates: dir1/dir2, dir1/dir3, dir1/dir4

# Brace expansion with spaces (spaces ARE part of directory names)
mkdir-rs dir1/{dir2, dir3, dir4}
# Creates: dir1/dir2, dir1/ dir3, dir1/ dir4

# Create parent directories as needed
mkdir-rs -p deep/nested/{a,b,c}/structure

# Verbose output
mkdir-rs -v project/{src,docs,tests}

# Multiple brace expansions
mkdir-rs {project1,project2}/{src,docs}
# Creates: project1/src, project1/docs, project2/src, project2/docs

# Nested brace expansions
mkdir-rs project/{src/{main,test},docs}
# Creates: project/src/main, project/src/test, project/docs

Options

  • -p, --parents - Create parent directories as needed (no error if exists)
  • -v, --verbose - Print a message for each directory created
  • -m, --mode <MODE> - Set permissions (ignored on Windows, for compatibility)

Comparison with Linux mkdir

Feature Linux mkdir mkdir-rs
Brace expansion Shell handles it Built-in
Parent creation (-p) ✅ ✅
Verbose mode (-v) ✅ ✅
Mode setting (-m) ✅ ✅ (ignored on Windows)
Multiple patterns ✅ ✅
Windows support ❌ (requires WSL) ✅ Native

Edge Cases Handled

  • Empty brace expansions: {} → Error
  • Unmatched braces: {a,b → Error
  • Spaces in expansions: Preserved as-is (matches Linux behavior)
  • Path separator normalization: Automatically converts / to \ on Windows
  • Directory already exists: With -p, succeeds silently; without -p, reports error
  • Deeply nested patterns: Handles arbitrary nesting levels
  • Unicode characters: Full UTF-8 support in directory names

Building from Source

# Debug build
cargo build

# Optimized release build  
cargo build --release

# Run tests
cargo test

# Lint and format
cargo clippy
cargo fmt

Testing

# Run all tests
cargo test

# Run with output
cargo test -- --nocapture

# Run specific test
cargo test test_brace_expansion_with_spaces

License

MIT License - See LICENSE file for details

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

👤 Author

Hadi Cahyadi

Buy Me a Coffee

Donate via Ko-fi

Support me on Patreon