mkfile is a powerful, lightweight PowerShell utility that streamlines file and directory creation. Whether youβre scaffolding new projects, organizing directories, or automating workflows, mkfile eliminates repetitive manual file creation with a single command.
Perfect for developers, DevOps engineers, and anyone who spends time setting up file structures manually.
β
Create Single or Multiple Files - Add one file or dozens in a single command
β
Auto-Create Parent Directories - No more manual folder creation
β
Nested Path Support - Create deeply nested file structures instantly
β
Path Safety - Prevents accidental file creation outside your working directory
β
Simple & Intuitive - Minimal learning curve, maximum productivity
β
Cross-Friendly - Works with relative paths and complex directory structures
β
Lightweight - Zero dependencies, pure PowerShell
. .\mkfile.ps1
# Single file
mkfile index.html
# Multiple files
mkfile index.html style.css script.js
# Nested structure (directories auto-created)
mkfile src/components/Button.tsx src/styles/Button.css
Thatβs it! Files are created instantly.
mkfile.ps1 from this repository. .\mkfile.ps1
Make mkfile available in every PowerShell session:
# Open your PowerShell profile
notepad $PROFILE
# Add this line to the file
. "C:\path\to\mkfile.ps1"
# Save and close
# Reload your profile
. $PROFILE
Now you can use mkfile from any directory!
mkfile.ps1 to a permanent location (e.g., C:\Scripts\)mkfile [OPTIONS] <file_path> [<file_path2>] [<file_path3>]...
mkfile README.md
mkfile index.html
mkfile config.json
mkfile app.js style.css index.html manifest.json
# Creates 'src' directory automatically
mkfile src/main.ts
mkfile src/index.tsx
# Creates nested directories
mkfile src/components/Button/Button.tsx
mkfile src/components/Button/Button.css
mkfile src/components/Button/index.ts
mkfile src/App.tsx public/index.html docs/API.md config/settings.json
mkfile -v
# Output: v1.1.0
mkfile -i
# Output: mkfile: A PowerShell function to create files.
# Repository: https://github.com/mehedi-codes/mkfile
# Author: mehedi-codes
# Version: v1.1.0
mkfile public/index.html `
src/App.tsx `
src/index.tsx `
src/App.css `
src/components/Header/Header.tsx `
src/components/Header/Header.css `
.env.local `
.gitignore `
README.md
mkfile src/server.js `
src/routes/api.js `
src/middleware/auth.js `
src/config/database.js `
tests/server.test.js `
.env `
.env.example `
package.json
mkfile docs/Getting-Started.md `
docs/API/Authentication.md `
docs/API/Users.md `
docs/API/Products.md `
docs/CONTRIBUTING.md
mkfile src/__init__.py `
src/main.py `
src/utils/helpers.py `
tests/test_main.py `
requirements.txt `
README.md `
.gitignore
If a directory in the path doesnβt exist, mkfile creates it automatically:
mkfile very/deeply/nested/structure/file.txt
# Creates all directories if they don't exist
# Output: Directory 'C:\...\very\deeply\nested\structure' created.
# File 'C:\...\very\deeply\nested\structure\file.txt' created successfully.
If a file already exists, mkfile skips it gracefully:
mkfile existing_file.txt
# Output: File 'C:\path\to\existing_file.txt' already exists.
mkfile provides clear error messages:
mkfile ../../../outside/project/file.txt
# Output: Error: Target path is outside the current working directory.
Found a bug? Have a feature request? Weβd love your help!
| Feature | mkfile | mkdir -p | New-Item |
|---|---|---|---|
| Create Files | β | β | β |
| Auto-Create Dirs | β | β | β |
| Multiple Files | β | β | β οΈ Verbose |
| Ease of Use | βββββ | ββ | βββ |
| Speed | βββββ | ββββ | βββ |
v1.1.0 (Current)
This project is provided as-is for community use. See the repository for more details.