Duplicate File Finder
A fast, parallelized CLI tool and library for detecting duplicate files by content. Designed for efficiency, usability, and cross-platform compatibility.
Features
- Recursively scans directories for duplicate files
- Detects duplicates using a multi-stage strategy:
- Group by file size
- Compare quick hash (first 8 KB using
twox-hash) - Validate full content with SHA-256
- Generates detailed reports with metadata and potential space savings
- Supports progress indicators and structured logging
- Multithreaded using
rayonfor high performance - Usable as both a CLI tool and a Rust library
Installation
Add to your project:
[]
= "0.1"
Or install the CLI binary:
Usage
Command Line
Example
This scans ~/Documents and writes a human-readable report to reports/duplicate_file_report.txt.
Running duplicate_file_finder with no arguments scans the directory it is executed from and saves duplicate_file_report.txt in that same directory.
Options
| Option | Description |
|---|---|
-h, --help |
Show help message |
--output <path> |
Specify output file or directory for the report |
-d, --directories <DIR> |
Scan multiple directories as a single pool |
If the output path is a directory, the report is saved as duplicate_file_report.txt within that directory.
Sample Output
Duplicate File Finder Report
Generated by: alice
Start Time: 20250707 15:00:00
End Time: 20250707 15:00:42
Base Directory: /home/alice/Documents
Total Potential Space Savings: 1.43 GB
Size: 143.21 MB
/home/alice/Documents/archive/copy1.iso
/home/alice/Documents/archive/copy2.iso
Library Usage
You can also integrate the crate into your own Rust projects:
use ;
use Path;
Logging
Logs are written to duplicate_finder.log and include timestamps and severity levels.
Platform Support
- Linux
- macOS
- Windows
Performance
The tool is optimized for performance using:
- Parallel iteration via
rayon - Incremental filtering (size → quick hash → full hash)
- Efficient I/O with buffered reading
Development
Running Tests
Building the Binary
License
This project is licensed under the MIT License. See LICENSE for details.
Contributing
Contributions, issues, and feature requests are welcome!
- Fork the repository
- Create a new branch (
git checkout -b feature/awesome) - Commit your changes (
git commit -am 'Add awesome feature') - Push to the branch (
git push origin feature/awesome) - Create a new Pull Request
Made with ❤️ by Andrew Sims