A Rust-based directory management tool that helps you find and manage directories. It provides terminal user interface for discovering directories matching specific patterns.
dir-kill scans your file system to find directories that match specified patterns. It's particularly useful for finding and deleting stale project directories like node_modules, target, dist, and other build artifacts to help clean up disk space.
# Find all node_modules directories
dir-kill ls <pattern> <path-directory (default: .)>dir-kill ls <pattern> [OPTIONS]
OPTIONS:
-h, --help Show help information
-i, --ignore <PATTERNS> Comma-separated regex patterns for directories to ignore# Find node_modules directories
dir-kill ls node_modules
# Find node_modules directories but ignore .git and temp directories
dir-kill ls node_modules --ignore "\.git,temp"
# Find target directories but ignore specific project directories
dir-kill ls target --ignore "important-project,\.cargo"
# Find dist directories with multiple ignore patterns
dir-kill ls dist -i "node_modules,\.git,backup"dir-kill automatically avoids nested pattern matches to prevent infinite recursion and redundant results. For example:
- When searching for
node_modules, it won't scan inside existingnode_modulesdirectories - When searching for
dist, it won't scan inside existingdistdirectories - When searching for
target, it won't scan inside existingtargetdirectories
This behavior:
- Prevents infinite recursion in deeply nested directory structures
- Improves performance by avoiding redundant scanning
- Reduces noise in results by focusing on top-level matches
- Works automatically for any pattern you search for
Examples:
# Will find /project/node_modules but skip /project/node_modules/some-package/node_modules
dir-kill ls node_modules
# Will find /project/dist but skip /project/dist/build/dist
dir-kill ls dist
# Will find /project/target but skip /project/target/debug/target
dir-kill ls target# Clone and build
git clone https://github.com/saiumesh535/dir-kill.git
cd dir-kill
cargo build --release
# Run directly
cargo run -- ls node_modules- Download the latest release from here
- chmod +x dir-kill
- mv dir-kill /usr/local/bin/dir-kill
dir-kill ls node_modules