cp-cli

raw JSON →
2.0.0 verified Sat Apr 25 auth: no javascript

cp-cli is a Node.js CLI tool that replicates the UNIX cp command for cross-platform file and directory copying. Current stable version is 2.0.0, which exits with code 1 on error instead of 0 as in prior versions. It is a lightweight alternative to shell commands or more complex build tools, with no runtime dependencies after installation (only dev deps). Release cadence is irregular; the last release was v2.0.0 with a breaking change in exit code behavior.

error Error: Cannot find module 'cp-cli'
cause Package not installed locally or globally.
fix
Run 'npm install -g cp-cli' or use 'npx cp-cli'.
error Usage: cp-cli [-d] source target
cause Missing source or target arguments.
fix
Provide both source and target file paths (e.g., 'cp-cli foo.txt bar.txt').
error Error: ENOENT: no such file or directory
cause Source file does not exist.
fix
Check that the source path is correct and the file exists.
breaking Exit code changed from 0 to 1 on error in v2.0.0
fix Update scripts that check exit codes: errors now return 1 instead of 0.
gotcha Does not support recursive copying by default; no -R option
fix Use other tools like fs-extra or ncp for recursive directory copying.
gotcha Only copies a single file or into an existing directory; no glob or multiple sources
fix Use bash cp or other tools like copyfiles for glob patterns.
npm install cp-cli
yarn add cp-cli
pnpm add cp-cli

Demonstrates global installation and common copy operations using cp-cli CLI.

# Install globally
npm install -g cp-cli

# Copy a file
cp-cli foo.txt bar.txt

# Copy file into directory
cp-cli foo.txt dest/

# Using npx (no install)
npx cp-cli source.txt target.txt