Skip to content

High-performance file deletion CLI tool with system trash support!

License

Notifications You must be signed in to change notification settings

elemeng/spacefree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

๐Ÿš€ spacefree

๐Ÿš€ Ultra-fast file deletion CLI tool (supports trash)

Rust Crates.io License: MIT


โœจ Features

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 Support

Platform Trash Support Status
๐Ÿง Linux โœ… Yes GTK, KDE, XDG compatible
๐ŸŽ macOS โœ… Yes Native Finder trash
๐ŸชŸ Windows โœ… Yes Recycle Bin

๐Ÿ“ฆ Installation

From crates.io

cargo install spacefree

The installed binary is named spa.

From source

git clone https://github.com/elemeng/spacefree
cd spacefree
cargo install --path .

Or build and run directly:

cargo build --release
./target/release/spa --help

๐ŸŽฎ Quick Start

Basic Usage

# ๐Ÿ—‘๏ธ  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

๐Ÿ“‹ Usage Examples

Filter by File Size

# 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 kilobytes

File Patterns (Glob)

By 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"

Batch Processing from File

Create a jobs.txt file:

J12
J13, J14
J15

Then run:

spa jobs.txt

Or mix directories and files:

spa J12 jobs.txt J20

Skip Confirmation

# Auto-confirm deletion (use with caution!)
$ spa J12 --yes

Parallel Workers

# Use 16 parallel workers (default: num_cpus * 4)
$ spa J12 -p 16

Verbose Mode

# Show all files to be deleted
$ spa J12 -v --dry-run

๐Ÿ› ๏ธ Command Reference

Usage: 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

โš ๏ธ Safety First

  1. Always use --dry-run first to preview what will be deleted
  2. By default, ALL files are selected - use -g to filter by pattern
  3. Use --trash for safer deletion (can be recovered from system trash)
  4. By default, deletion is PERMANENT - files are not recoverable
  5. Double-check your paths before running without --dry-run

Confirmation

When deleting without --yes, you'll be prompted:

Type YES to continue:

Accepted responses: YES, Yes, Y, y (case insensitive)


๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development Setup

# 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 fmt

Bug Reports & Feature Requests

Please 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

๐Ÿ“„ License

MIT ยฉ elemeng


Made with โ˜• and ๐Ÿฆ€

About

High-performance file deletion CLI tool with system trash support!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages