{"id":17036,"library":"move-cli","title":"move-cli: Robust File & Directory Mover CLI","description":"move-cli is a command-line interface (CLI) tool designed to move files and directories, acting as a robust alternative to `fs.rename` and mimicking the Unix `mv` utility. Its key differentiator is the ability to move items across different storage devices and to handle directories recursively, which standard `fs.rename` does not support natively. The package is built upon `andrewrk/node-mv` for its underlying moving logic. The current stable version is 2.0.0, released in late 2023, primarily focusing on dependency vulnerability fixes and CLI option parsing corrections. Its release cadence appears to be driven by maintenance and security updates rather than frequent feature additions, making it a stable choice for automated scripts and build processes.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/koenig-dominik/move-cli","tags":["javascript","mv","move","mv-cli","move-cli","rename","device","recursive","folder"],"install":[{"cmd":"npm install move-cli","lang":"bash","label":"npm"},{"cmd":"yarn add move-cli","lang":"bash","label":"yarn"},{"cmd":"pnpm add move-cli","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core underlying library for file and directory moving logic, especially for cross-device operations.","package":"mv","optional":false}],"imports":[{"note":"This package is primarily a CLI tool. After global installation, it's executed directly in the terminal.","symbol":"move-cli (Global Install)","correct":"$ npm install -g move-cli\n$ move-cli source/path dest/path"},{"note":"For local installations, `npx` is the recommended way to execute the CLI tool without adding it to the global PATH.","symbol":"move-cli (Local Install via npx)","correct":"$ npm install move-cli\n$ npx move-cli source/path dest/path"},{"note":"Common pattern for integrating `move-cli` into build or automation workflows within a project's `package.json` scripts.","symbol":"move-cli (package.json script)","correct":"{\n  \"scripts\": {\n    \"move-files\": \"move-cli 'src/**/*.js' dist/js\"\n  }\n}"}],"quickstart":{"code":"npm install -g move-cli\n\n# Create some dummy files and directories\nmkdir -p source/folder1 source/folder2\ntouch source/folder1/file1.txt source/folder2/file2.js\n\n# Move a single file\nmove-cli source/folder1/file1.txt destination/newfile.txt\n\n# Move a directory (and create destination parent if needed)\nmove-cli source/folder2 destination/new_folder --mkdirp\n\n# Move multiple files using a glob pattern, preventing overwrite\nmove-cli 'source/**/*.js' other_destination --noclobber","lang":"javascript","description":"Demonstrates global installation, moving single files, moving directories with parent creation, and moving multiple files with glob patterns and no-clobber option."},"warnings":[{"fix":"Review existing scripts and update single-dash long flags (e.g., `-mkdirp`) to their correct double-dash counterparts (e.g., `--mkdirp`, `--noclobber`, `--limit`).","message":"Version 2.0.0 fixed an issue with command-line flag parsing, specifically regarding single-dash versus double-dash for long options. While `--mkdirp` was the intended usage, older scripts might have incorrectly used `-mkdirp`. Post v2.0.0, ensure correct double-dash syntax for long options.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Always install the latest version of `move-cli` (`npm install -g move-cli@latest` or `npm install move-cli@latest`) to benefit from security fixes.","message":"Prior versions (1.2.0 and earlier) had reported dependency vulnerabilities. Although v2.0.0 explicitly addresses these, it's crucial to ensure you are running the latest stable version for security patches.","severity":"gotcha","affected_versions":"<2.0.0"},{"fix":"Add the `--noclobber` or `-nc` flag to your `move-cli` command when overwriting is not desired: `move-cli source dest --noclobber`.","message":"By default, `move-cli` will overwrite existing files at the destination. If you need to prevent overwriting, you must explicitly use the `--noclobber` or `-nc` option.","severity":"gotcha","affected_versions":">=1.1.2"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"If intending global use: `npm install -g move-cli`. If local: `npx move-cli ...` or add to `package.json` scripts.","cause":"The `move-cli` package is not installed globally or is not in your system's PATH, or a locally installed version is not being called via `npx` or a `package.json` script.","error":"move-cli: command not found"},{"fix":"Either rename the destination, remove the existing destination, or omit the `--noclobber` flag if overwriting is acceptable.","cause":"The destination file or directory already exists, and the `--noclobber` option was used, preventing an overwrite.","error":"Error: EEXIST: file already exists, '...' -> '...'"},{"fix":"Ensure the current user has appropriate file system permissions for both the source and destination directories. You may need to use `sudo` (on macOS/Linux) or run your terminal as an administrator (on Windows) as a last resort, though this is generally not recommended for regular use.","cause":"The user running the `move-cli` command lacks the necessary read/write permissions for either the source or destination paths.","error":"Error: EACCES: permission denied, rename '...' -> '...'"}],"ecosystem":"npm","meta_description":null}