What is del-cli?
The del-cli package is a command-line tool for deleting files and directories using glob patterns. It is a convenient wrapper around the 'del' module, making it easy to use from the command line.
What are del-cli's main functionalities?
Delete files
This feature allows you to delete a specific file by providing its path.
del-cli 'path/to/file.txt'
Delete directories
This feature allows you to delete an entire directory and its contents by providing the directory path.
del-cli 'path/to/directory'
Use glob patterns
This feature allows you to use glob patterns to delete multiple files that match the pattern. For example, this command deletes all .txt files in the specified directory.
del-cli 'path/to/files/*.txt'
Force delete
This feature allows you to forcefully delete files or directories that are normally protected. Use with caution.
del-cli 'path/to/file.txt' --force
Dry run
This feature allows you to perform a dry run, showing which files would be deleted without actually deleting them. This is useful for testing your glob patterns.
del-cli 'path/to/files/*.txt' --dry-run
Other packages similar to del-cli
rimraf
Rimraf is a deep deletion module for node (like `rm -rf`). It is more focused on being a programmatic solution rather than a CLI tool, but it can be used from the command line as well. Rimraf is very robust and handles edge cases like long paths on Windows.
trash-cli
Trash-cli is a command-line tool that moves files and directories to the trash instead of permanently deleting them. This can be safer as it allows for recovery of accidentally deleted files. It is a good alternative if you want a safer deletion process.
shx
Shx is a wrapper around ShellJS Unix commands, providing cross-platform compatibility for shell commands. It includes a `rm` command that can be used to delete files and directories. Shx is useful if you need a broader set of shell commands in addition to deletion.
del-cli
Delete files and folders
Useful for use in build scripts and automated things.
Note that this does permanent deletion. See trash-cli
for something safer.
Install
$ npm install --global del-cli
Usage
$ de --help
Usage
$ de <path|glob> [...]
Options
-f, --force Allow deleting the current working directory and outside
-d, --dry-run List what would be deleted instead of deleting
Examples
$ de unicorn.png rainbow.png
$ de '*.png' '!unicorn.png'
It's de
and not del
, since del
is already a builtin command on Windows.
Related
- del - API for this module
- trash-cli - Move files and folders to the trash
License
MIT © Sindre Sorhus