<@_________________________>_._<_________________________@>
|| :-._ |###| :-._ ||
| | _.-' '--. |###| _.-' '--. | |
/ | .' _ -`\_ |] [| .' _ -`\_ | \
/ | / .----.`_.'----' | | / .----.`_.'----' | \
/` | ;/ ` | | ;/ ` | '\
| | /_; | | /_; | |
\ |_________________________| |_________________________| /
DupFin is a high-performance, multi-threaded console utility (with an upcoming WinForms GUI) designed to scan file systems and find duplicate files efficiently.
Unlike naive duplicate scanners that hash every single file and choke system memory, DupFin is engineered to minimize Disk I/O operations and maximize CPU utilization without causing Task Starvation.
- Smart O(1) Pre-filtering: The engine first groups files by their exact byte size using
Directory.EnumerateFiles. Files with a unique size are immediately discarded from the queue, saving up to 90% of unnecessary hashing and disk reads. - Parallel Asynchronous Hashing: Uses
Parallel.ForEachAsyncconstrained byEnvironment.ProcessorCount. This perfectly balances CPU-bound mathematical operations (hashing) and I/O-bound disk reads, preventing Disk Thrashing on HDDs/SSDs. - Thread-Safe Architecture: Completely lock-free asynchronous operations utilizing
ConcurrentDictionaryandConcurrentBagto prevent thread deadlocks and bottlenecks during simultaneous file processing. - Fault-Tolerant: Gracefully handles
UnauthorizedAccessExceptionfor locked/system files without crashing the scan pipeline, usingFileShare.Readfor files opened by other processes.
- Language: C#
- Framework: .NET 8
- Hashing Algorithms: MD5, SHA-256, SHA-512
- Traversal: Recursively scans the target directory (Memory-safe enumeration).
- Optimization: Filters out files that do not share the exact same size in bytes.
- Hashing: Applies the selected cryptographic hash (Default: SHA-256) only to potential duplicates.
- Reporting: Outputs a clean, structured summary of duplicate groups and saves the results to a
.txtfile on the Desktop.
Run the application and follow the interactive prompts:
- Enter the target directory path (or press Enter for the current directory).
- Choose the preferred hash algorithm.
- Review the results in the console and opt to save them to a formatted text file.