touchdir
v1.0.2
Published
A CLI tool to create directories
Readme
touchdir
A CLI tool to create directories and files in one go.
touchdir is a utility that combines the functionality of mkdir -p and touch. It allows you to create files and their parent directories simultaneously, ensuring that the path exists before creating the file.
Features
- Creates deep directory structures automatically (like
mkdir -p). - Creates empty files if they don't exist (like
touch). - Skips file creation if the file already exists.
- Built with Effect.
Installation
You can use touchdir directly without installation via npx (or pnpm dlx), or install it globally.
Using npx
npx touchdir path/to/my/file.txtGlobal Installation
npm install -g touchdir
# or
pnpm add -g touchdirUsage
Basic usage requires providing one or more file paths.
touchdir <path> [path...]Examples
Create a file and its parent directories:
touchdir src/components/Button.tsxThis will create src/ and src/components/ if they don't exist, and then create Button.tsx.
Create multiple files:
touchdir src/api/user.ts src/api/posts.tsDevelopment
This project uses pnpm and tsx.
Prerequisites
- Node.js
- pnpm
Setup
pnpm installBuilding
To build the package for production:
pnpm buildTesting
To run the test suite:
pnpm testLinting
To lint the codebase:
pnpm lint