A high-performance Rust CLI tool to recursively clean .DS_Store junk files.
- Safe and Reliable: Only deletes
.DS_Storefiles with strict filename validation to prevent accidental deletion - Trash Instead of Delete: Moves files to system trash instead of permanently deleting them, allowing recovery
- High Performance: Written in Rust with efficient recursive directory traversal
- Preview Mode: Supports dry-run mode to preview before execution
- Cross-Platform: Supports Windows, macOS, and Linux
- Rich Options: Supports depth control, hidden directory skipping, and more
# Clone or navigate to the project directory
cd clean_ds_store
# Build the project
cargo build --release
# The executable will be located at:
# target/release/clean-ds-store (Linux/macOS)
# target\release\clean-ds-store.exe (Windows)cargo install --path .# Clean current directory (preview mode)
clean-ds-store --dry-run
# Clean current directory (actual execution)
clean-ds-store
# Clean specific directory
clean-ds-store /path/to/directory
# Verbose output
clean-ds-store --verbose
# Or use short form
clean-ds-store -v# Preview mode (only show files that would be removed, without actual deletion)
clean-ds-store --dry-run
clean-ds-store -n
# Limit recursion depth
clean-ds-store --max-depth 3
# Do not recurse into subdirectories (current directory only)
clean-ds-store --no-recursive
# Skip hidden directories
clean-ds-store --skip-hidden
# Combine options
clean-ds-store /path/to/dir --verbose --max-depth 5 --skip-hiddenclean-ds-store --help$ clean-ds-store --dry-run
Scan path: /Users/username/projects
Mode: Preview mode (files will not be removed)
[Preview] /Users/username/projects/.DS_Store
[Preview] /Users/username/projects/subfolder/.DS_Store
==================================================
Cleanup Statistics:
Found .DS_Store files: 2
==================================================
Tip: Remove --dry-run flag to actually execute cleanup$ clean-ds-store --verbose
Scan path: /Users/username/projects
Mode: Execution mode (files will be moved to trash)
[Found] /Users/username/projects/.DS_Store
✓ Moved to trash
[Found] /Users/username/projects/subfolder/.DS_Store
✓ Moved to trash
==================================================
Cleanup Statistics:
Found .DS_Store files: 2
Successfully moved to trash: 2
==================================================This tool implements multiple safety measures:
- Strict Filename Validation: Only processes files with exact name match of
.DS_Store - Double Check: Verifies filename again before moving to trash
- Type Checking: Ensures only files are processed, not directories
- Existence Check: Confirms file exists before operation
- Trash Instead of Delete: Files can be recovered from trash instead of being permanently deleted
- Uses
walkdircrate for efficient directory traversal - Atomic operation statistics for concurrent safety
- Minimal memory footprint
- Zero-copy path handling
- Rust - Systems programming language
- clap - Command-line argument parsing
- walkdir - Efficient recursive directory traversal
- trash - Cross-platform trash/recycle bin operations
- anyhow - Error handling
- colored - Colored terminal output
cargo testcargo run -- --dry-run
cargo run -- --helpcargo clippy
cargo fmtQ: Will files be permanently deleted? A: No. All files are moved to the system trash and can be recovered at any time.
Q: How do I recover accidentally removed files? A: Recover them from the system trash (Windows Recycle Bin, macOS Trash, Linux Trash).
Q: Which platforms are supported? A: Windows, macOS, and Linux are supported.
Q: How is the performance? A: Written in Rust with excellent performance. Can quickly scan thousands of directories in large projects.
Q: Why not delete files directly? A: For safety reasons, moving to trash prevents data loss from accidental operations.
MIT License
Issues and Pull Requests are welcome!