Rust Cleanup Tool
A fast and simple CLI tool written in Rust to delete files and folders older than a specified age. It recursively scans a directory (default: current folder) and removes items based on their last modified time.
This project I did alongside chatGPT to learn/practice Rust.
Features
- Delete files and folders older than X days or years
- Recursive directory traversal
- Dry-run mode (preview without deleting)
- Log file with deleted items and errors
- Skip specific directories (e.g.
.git,node_modules) - Configurable target path
Installation
Make sure you have Rust installed: https://rust-lang.org Clone the repository and build:
cargo build --releaseRun:
./target/release/rcleanupUsage
Delete files older than 30 days
cargo run --days 30Delete files older than 2 years
cargo run --years 2Dry run (recommended first)
cargo run --years 3 --dry-runSkip directories
cargo run --skip .git --skip node_modulesCLI Options
| Option | Description |
|---|---|
--days |
Age in days |
--years |
Age in years |
--path |
Target directory (default: .) |
--dry-run |
Show what would be deleted |
--log |
Log file path |
--skip |
Directory names to skip |
License
MIT License