# bhuknuu/file-deduplication architecture

> Architecture diagram of the GitHub repository bhuknuu/file-deduplication, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bhuknuu/file-deduplication
- Repository: https://github.com/bhuknuu/file-deduplication

## Overview

WinDedup scans selected directories, hashes eligible files, groups byte-identical content, presents results through a Win32 GUI or CLI, and can delete, move, or hardlink duplicates. The graph reflects README-described capabilities as well as sampled calls; some CLI filtering, reporting, and GUI progress wiring is documented but not fully visible in the excerpts.

Main entry points: [`cli_main.c`](https://github.com/bhuknuu/file-deduplication/blob/main/cli_main.c) (CLI), [`gui_win32.c`](https://github.com/bhuknuu/file-deduplication/blob/main/gui_win32.c) (Win32 GUI), [`Traversal.c`](https://github.com/bhuknuu/file-deduplication/blob/main/Traversal.c) (Directory Scan), [`filter.c`](https://github.com/bhuknuu/file-deduplication/blob/main/filter.c) (Duplicate Grouping)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User Interfaces"]
  node_gui["Win32 GUI<br/>[gui_win32.c]"]
  node_cli["CLI<br/>[cli_main.c]"]
  node_taskbar["Taskbar Progress<br/>[gui_win32.c]"]
end

subgraph group_scan["Scanning"]
  node_traversal["Directory Scan<br/>[Traversal.c]"]
  node_hash["SHA-256 Hashing<br/>[Traversal.c]"]
  node_cache[("Hash Cache<br/>[dedup_cache.txt]")]
end

subgraph group_resolve["Duplicate Resolution"]
  node_detector["Duplicate Grouping<br/>[filter.c]"]
  node_actions["File Actions<br/>[action.c]"]
  node_results["Duplicate Results<br/>[common.h]"]
end

subgraph group_support["Filters and Reports"]
  node_filters["File Filters<br/>[features.c]"]
  node_reports["Exports and Logs<br/>[features.c]"]
  node_config["Configuration<br/>[features.c]"]
end

node_user(("User"))
node_filesystem["Windows Filesystem"]
node_cng["Windows CNG"]

node_user -->|"operates"| node_gui
node_user -->|"invokes"| node_cli
node_gui -->|"starts scan"| node_traversal
node_cli -->|"scans directories"| node_traversal
node_traversal -->|"enumerates metadata"| node_filesystem
node_traversal -->|"requests hashes"| node_hash
node_hash -->|"reads file bytes"| node_filesystem
node_hash -->|"computes SHA-256"| node_cng
node_traversal -->|"reads and writes"| node_cache
node_gui -->|"finds duplicates"| node_detector
node_cli -->|"groups files"| node_detector
node_detector -->|"assembles groups"| node_results
node_gui -->|"invokes actions"| node_actions
node_cli -->|"executes selected action"| node_actions
node_actions -->|"deletes moves or links"| node_filesystem
node_cli -.->|"applies options"| node_filters
node_cli -.->|"requests exports"| node_reports
node_cli -.->|"loads settings"| node_config
node_gui -.->|"reports progress"| node_taskbar

click node_gui "https://github.com/bhuknuu/file-deduplication/blob/main/gui_win32.c"
click node_cli "https://github.com/bhuknuu/file-deduplication/blob/main/cli_main.c"
click node_traversal "https://github.com/bhuknuu/file-deduplication/blob/main/Traversal.c"
click node_hash "https://github.com/bhuknuu/file-deduplication/blob/main/Traversal.c"
click node_cache "https://github.com/bhuknuu/file-deduplication/blob/main/dedup_cache.txt"
click node_detector "https://github.com/bhuknuu/file-deduplication/blob/main/filter.c"
click node_actions "https://github.com/bhuknuu/file-deduplication/blob/main/action.c"
click node_filters "https://github.com/bhuknuu/file-deduplication/blob/main/features.c"
click node_reports "https://github.com/bhuknuu/file-deduplication/blob/main/features.c"
click node_config "https://github.com/bhuknuu/file-deduplication/blob/main/features.c"
click node_results "https://github.com/bhuknuu/file-deduplication/blob/main/common.h"
click node_taskbar "https://github.com/bhuknuu/file-deduplication/blob/main/gui_win32.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_gui,node_cli,node_taskbar,node_user toneBlue
class node_traversal,node_hash,node_cache toneAmber
class node_detector,node_actions,node_results toneMint
class node_filters,node_reports,node_config toneRose
class node_filesystem,node_cng toneIndigo
```

## Components

### User Interfaces

- [Win32 GUI](https://github.com/bhuknuu/file-deduplication/blob/main/gui_win32.c): `gui_win32.c`
- [CLI](https://github.com/bhuknuu/file-deduplication/blob/main/cli_main.c): `cli_main.c`
- [Taskbar Progress](https://github.com/bhuknuu/file-deduplication/blob/main/gui_win32.c): `gui_win32.c`

### Scanning

- [Directory Scan](https://github.com/bhuknuu/file-deduplication/blob/main/Traversal.c): `Traversal.c`
- [SHA-256 Hashing](https://github.com/bhuknuu/file-deduplication/blob/main/Traversal.c): `Traversal.c`
- [Hash Cache](https://github.com/bhuknuu/file-deduplication/blob/main/dedup_cache.txt): `dedup_cache.txt`

### Duplicate Resolution

- [Duplicate Grouping](https://github.com/bhuknuu/file-deduplication/blob/main/filter.c): `filter.c`
- [File Actions](https://github.com/bhuknuu/file-deduplication/blob/main/action.c): `action.c`
- [Duplicate Results](https://github.com/bhuknuu/file-deduplication/blob/main/common.h): `common.h`

### Filters and Reports

- [File Filters](https://github.com/bhuknuu/file-deduplication/blob/main/features.c): `features.c`
- [Exports and Logs](https://github.com/bhuknuu/file-deduplication/blob/main/features.c): `features.c`
- [Configuration](https://github.com/bhuknuu/file-deduplication/blob/main/features.c): `features.c`

### Other components

- **User**
- **Windows Filesystem**
- **Windows CNG**

## Connections

- User → Win32 GUI: operates
- User → CLI: invokes
- Win32 GUI → Directory Scan: starts scan
- CLI → Directory Scan: scans directories
- Directory Scan → Windows Filesystem: enumerates metadata
- Directory Scan → SHA-256 Hashing: requests hashes
- SHA-256 Hashing → Windows Filesystem: reads file bytes
- SHA-256 Hashing → Windows CNG: computes SHA-256
- Directory Scan → Hash Cache: reads and writes
- Win32 GUI → Duplicate Grouping: finds duplicates
- CLI → Duplicate Grouping: groups files
- Duplicate Grouping → Duplicate Results: assembles groups
- Win32 GUI → File Actions: invokes actions
- CLI → File Actions: executes selected action
- File Actions → Windows Filesystem: deletes moves or links
- CLI → File Filters: applies options
- CLI → Exports and Logs: requests exports
- CLI → Configuration: loads settings
- Win32 GUI → Taskbar Progress: reports progress
