deca-delete
v1.0.0
Published
A simple tool to recursively delete files with a specific suffix in a directory.
Downloads
71
Maintainers
Readme
🗑️ deca-delete
A Node.js CLI tool for recursively deleting files with a specific file suffix across directories. 🗂️🔍
📦 Installation
Install globally using npm:
npm install -g deca-delete
Or as a development dependency in your project:
npm install --save-dev deca-delete
🚀 Usage
CLI Usage
deca-delete <rootDirectory> <fileSuffix>
Examples:
Delete all JavaScript test files: 🧪
deca-delete ./src .test.js
Delete all text files: 📄
deca-delete /path/to/project .txt
Programmatic Usage 💻
const { deleteFilesBySuffix } = require('deca-delete');
deleteFilesBySuffix('/path/to/directory', '.js');
✨ Features
- 🔄 Recursively search and delete files with a specific suffix
- 🖥️ Simple CLI interface
- 🛡️ Error handling for directory and file operations
- 📝 Detailed console logging
🛠️ Options
rootDir
: The root directory to start searchingsuffix
: The file suffix to match (must start with a '.')
⚠️ Safety Notes
⚠️ Caution: This tool permanently deletes files. Always double-check your directory and suffix before running. 🚨
🐛 Error Handling
- Invalid directories will produce an error message
- Files that cannot be deleted will log an error without stopping the entire process
📄 License
MIT
🤝 Contributing
Contributions are welcome! Please open an issue or submit a pull request on the GitHub repository. 🌟