๐ Ultra-fast file deletion CLI tool (supports trash)
| Feature | Description |
|---|---|
| ๐ Blazing Fast | Parallel scanning & deletion with configurable workers |
| ๐ก๏ธ Safe | Optional trash mode, dry-run preview, flexible confirmation |
| ๐ฏ Flexible | Glob patterns, size filters, exclusion rules |
| ๐ Batch Ready | Accept directories or path list files (CSV/TXT) |
| ๐งน Smart | Automatically skips non-existent paths, deduplicates |
| ๐๏ธ Verbose | Optional detailed file listing for visibility |
| Platform | Trash Support | Status |
|---|---|---|
| ๐ง Linux | โ Yes | GTK, KDE, XDG compatible |
| ๐ macOS | โ Yes | Native Finder trash |
| ๐ช Windows | โ Yes | Recycle Bin |
cargo install spacefreeThe installed binary is named spa.
git clone https://github.com/elemeng/spacefree
cd spacefree
cargo install --path .Or build and run directly:
cargo build --release
./target/release/spa --help# ๐๏ธ Delete ALL files from directories (be careful!)
$ spa J12 J13 J14
# ๐ Preview before delete (dry run - recommended)
$ spa J12 --dry-run
# ๐ฏ Delete only specific file types
$ spa J12 -g "*.log"
# โป๏ธ Move to system trash (safer)
$ spa J12 --trash# Only files >= 10 megabytes
$ spa J12 --min-size 10M
# Supported units: B (bytes), K/KB, M/MB, G/GB, T/TB
$ spa J12 --min-size 1G # 1 gigabyte
$ spa J12 --min-size 512k # 512 kilobytesBy default, all files (**/*) are selected. Use -g to filter:
# Delete only .log files
$ spa J12 -g "*.log"
# Multiple patterns
$ spa J12 -g "**/*.{tmp,cache}"
# Exclude certain patterns
$ spa J12 -g "*.txt" --exclude "**/important.txt"Create a jobs.txt file:
J12
J13, J14
J15
Then run:
spa jobs.txtOr mix directories and files:
spa J12 jobs.txt J20# Auto-confirm deletion (use with caution!)
$ spa J12 --yes# Use 16 parallel workers (default: num_cpus * 4)
$ spa J12 -p 16# Show all files to be deleted
$ spa J12 -v --dry-runUsage: spa [OPTIONS] <PATHS>...
Arguments:
<PATHS>... Job directories or path list files (comma/space/newline separated)
Options:
-g, --glob <PATTERN> Glob pattern for files to delete [default: **/* (all files)]
--exclude <PATTERN> Glob pattern to exclude from deletion
--min-size <SIZE> Minimum file size (e.g., 100, 10k, 5M, 2G, 1T) [default: 0]
--trash Move to system trash instead of permanent delete
--dry-run Preview what would be deleted without actually deleting
-y, --yes Skip confirmation prompt
-p, --parallelism <N> Number of parallel workers [default: num_cpus * 4]
-v, --verbose Show all files to be deleted (verbose mode)
-h, --help Print help
-V, --version Print version
- Always use
--dry-runfirst to preview what will be deleted - By default, ALL files are selected - use
-gto filter by pattern - Use
--trashfor safer deletion (can be recovered from system trash) - By default, deletion is PERMANENT - files are not recoverable
- Double-check your paths before running without
--dry-run
When deleting without --yes, you'll be prompted:
Type YES to continue:
Accepted responses: YES, Yes, Y, y (case insensitive)
Contributions are welcome! Please feel free to submit a Pull Request.
# Clone the repository
git clone https://github.com/elemeng/spacefree
cd spacefree
# Run tests
cargo test
# Run with debug output
cargo run --bin spa -- J12 --dry-run
# Build release binary
cargo build --release
# Check code style
cargo clippy
# Format code
cargo fmtPlease use GitHub Issues to report bugs or request features.
When reporting bugs, please include:
- Operating system and version
- Rust version (
rustc --version) - Steps to reproduce
- Expected vs actual behavior
MIT ยฉ elemeng
Made with โ and ๐ฆ