Real-time file duplicate detection with GUI alerts using Named Pipes IPC.
βββββββββββββββββββββββββββββββββββββββ
β Detection Engine (ddas_engine) β
β - Scans directory for files β
β - Computes BLAKE3 hashes β
β - Detects duplicates β
β - Monitors file system changes β
β - Named Pipe Server (IPC) β
ββββββββββββββββ¬βββββββββββββββββββββββ
β
Named Pipe: \\.\pipe\ddas_ipc
β
ββββββββββββββββ΄βββββββββββββββββββββββ
β GUI Tray App (ddas_gui) β
β - System tray icon β
β - Toast notifications β
β - Duplicate file report window β
β - File management (delete, open) β
β - Named Pipe Client (IPC) β
βββββββββββββββββββββββββββββββββββββββ
DDAS/
βββ src/
β βββ main.c # Engine entry point
β βββ hash_table.c # Hash table with IPC integration
β βββ file_ops.c # File operations
β βββ scanner.c # Directory scanner
β βββ monitor.c # File system monitor
β βββ empty_files.c # Empty file tracking
β βββ utils.c # Utilities
β βββ ipc_pipe.c # Named Pipe IPC (NEW)
βββ gui/
β βββ gui_tray.c # Tray GUI application (NEW)
βββ include/
β βββ ipc_pipe.h # IPC header (NEW)
β βββ [other headers]
βββ blake/ # BLAKE3 implementation
βββ build/ # Build output
βββ Makefile
mingw32-makeYou should see:
Compiling src/main.c...
Compiling src/ipc_pipe.c...
...
Detection Engine built successfully!
GUI Application built successfully!
========================================
DDAS Build Complete!
========================================
Engine: ddas_engine.exe
GUI: ddas_gui.exe
mingw32-make run-bothThis will:
- β Start the detection engine (minimized console window)
- β Wait 2 seconds for engine to initialize
- β Start the GUI (system tray icon appears)
Create a duplicate file:
cd C:\Users\Sahil\Documents\testfolder
echo Hello World > file1.txt
copy file1.txt file2.txtWhat happens:
- π Engine detects the duplicate
- π¬ Toast notification appears: "Duplicate found: file2.txt"
- π±οΈ Click the notification
- π Report window opens showing both files
| Command | What it does |
|---|---|
mingw32-make |
Build everything |
mingw32-make run-both |
Start engine + GUI |
mingw32-make stop |
Stop everything |
mingw32-make clean |
Clean build files |
mingw32-make help |
Show all commands |
mingw32-make run-engine- Console stays open
- Shows all file operations
- Press Ctrl+C to stop
# In terminal 1:
mingw32-make run-engine
# In terminal 2:
mingw32-make run-guiSymptoms:
- No notifications appearing
- Tray icon present but inactive
Solution:
- Make sure engine is running first
- Check engine console for:
[IPC] GUI client connected - Restart in correct order: engine β GUI
mingw32-make stop
mingw32-make run-bothSymptoms:
- Engine fails to start
- Error about pipe creation
Solution: Kill any existing processes:
mingw32-make stopOr manually:
taskkill /F /IM ddas_engine.exe
taskkill /F /IM ddas_gui.exeSolution:
- Check Windows notification area (bottom-right)
- Click the up arrow (^) to show hidden icons
- Right-click taskbar β Taskbar settings β Turn on all system icons
Check:
-
All files are in place:
src/ipc_pipe.c include/ipc_pipe.h gui/gui_tray.c -
Updated
hash_table.cwith IPC integration -
Clean and rebuild:
mingw32-make clean mingw32-make
Edit the Makefile, find these lines:
# Line ~97 (in run-engine target)
@.\$(ENGINE_TARGET) C:\Users\Sahil\Documents\testfolder --watch
# Line ~117 (in create-start-script target)
@echo start "DDAS Engine" /MIN $(ENGINE_TARGET) "C:\Users\Sahil\Documents\testfolder" --watch >> start_ddas.batChange C:\Users\Sahil\Documents\testfolder to your desired path.
Right-click the tray icon:
- Show Last Alert β Opens report window for last duplicate
- About β Shows version info
- Exit β Closes GUI (engine keeps running)
Displays:
- Trigger file (the new file that caused the alert)
- All duplicate files in the group
- File details: size, modified date
Actions:
- Open File Location β Opens Explorer at file location
- Delete Selected β Moves file to Recycle Bin (safe delete)
- Close β Closes window
=== File Duplicate Detector with Real-time Monitoring ===
Directory: C:\Users\Sahil\Documents\testfolder
Mode: Scan + Watch
[IPC] Named Pipe server initialized on \\.\pipe\ddas_ipc
[IPC] Waiting for GUI client to connect...
=== File System Monitor Started ===
Watching for changes during scan and after...
[SCAN] C:\Users\Sahil\Documents\testfolder\file1.txt
[SCAN] C:\Users\Sahil\Documents\testfolder\file2.txt
[DUPLICATE DETECTED]
New file: C:\Users\Sahil\Documents\testfolder\file2.txt
Matches existing files:
- C:\Users\Sahil\Documents\testfolder\file1.txt
[IPC] GUI client connected
[DUPLICATE DETECTED]
New file: C:\...\file2.txt
Matches existing files:
- C:\...\file1.txt
cd C:\Users\Sahil\Documents\testfolder
echo Test > original.txt
copy original.txt copy1.txt
copy original.txt copy2.txtExpected: 2 alerts (for copy1.txt and copy2.txt)
mkdir subdir
copy original.txt subdir\duplicate.txtExpected: 1 alert for subdir\duplicate.txt
echo Modified >> original.txtExpected: File reprocessed, old duplicates removed, new hash added
mingw32-make run-both- Save files as normal
- Get alerts when duplicates appear
- Review duplicates periodically
mingw32-make stopOr: Right-click tray icon β Exit (stops GUI, engine keeps running)
- Test the basic functionality with the commands above
- Watch the console to understand the detection flow
- Try the GUI features (notifications, report window, delete)
- Experiment with different file scenarios
Once you're comfortable, you can extend the system with:
- Database integration (SQLite)
- DELETE_FILES command implementation
- Quarantine directory
- Service mode for auto-start
- Keep console window visible during development to see IPC messages
- Test GUI reconnection by closing and reopening it
- Use different test directories to avoid confusion
- Check Windows Event Viewer if pipe issues occur
- Monitor with Process Explorer to see pipe connections
BUILD: mingw32-make
RUN: mingw32-make run-both
STOP: mingw32-make stop
CLEAN: mingw32-make clean
HELP: mingw32-make help
File Locations:
- Engine:
ddas_engine.exe - GUI:
ddas_gui.exe - Pipe:
\\.\pipe\ddas_ipc - Test Dir:
C:\Users\Sahil\Documents\testfolder
{
"type": "ALERT",
"event": "DUPLICATE_DETECTED",
"trigger_file": {
"filepath": "C:\\Users\\sahil\\Downloads\\file.txt",
"filename": "file.txt",
"filehash": "a3f4...64hex",
"filesize": 12345,
"last_mod": "2026-01-10T12:34:56Z",
"file_index": 987654321
},
"duplicates": [
{
"filepath": "D:\\Backup\\file_copy.txt",
"filename": "file_copy.txt",
"filesize": 12345,
"last_mod": "2026-01-09T09:00:00Z",
"file_index": 111222333
}
],
"timestamp": "2026-01-10T12:34:57Z"
}{
"type": "ALERT",
"event": "SCAN_COMPLETE",
"total_files": 150,
"duplicate_groups": 5,
"timestamp": "2026-01-10T12:35:00Z"
}- β BLAKE3 cryptographic hashing
- β Recursive directory scanning
- β Real-time file system monitoring
- β Empty file detection
- β Named Pipe IPC server
- β Thread-safe hash table
- β Pattern-based file ignoring
- β System tray icon
- β Toast notifications
- β Duplicate file report window
- β File list with details (path, size, modified date)
- β Open file location in Explorer
- β Delete files (Recycle Bin)
- β Named Pipe IPC client
- β Auto-reconnect on disconnect
- Create test directory with duplicates:
mkdir C:\test_duplicates
echo Hello World > C:\test_duplicates\file1.txt
copy C:\test_duplicates\file1.txt C:\test_duplicates\file2.txt- Start engine and GUI
- Observe:
- Console shows scan progress
- GUI notification appears
- Report window shows duplicate group
- With engine and GUI running
- Copy a file into monitored directory
- Observe instant notification
- Start engine first
- Start GUI β connects successfully
- Close GUI
- Restart GUI β reconnects automatically
- Symptom: No notifications appearing
- Fix: Ensure engine is running first
- Check: Engine console should show
[IPC] Waiting for GUI client to connect...
- Symptom: Engine fails with "pipe in use"
- Fix: Kill existing engine process:
taskkill /F /IM ddas_engine.exe- Symptom: GUI starts but no tray icon
- Fix: Check Windows notification area settings
- Enable "Always show all icons in notification area"
- Implement DELETE_FILES command
- Add quarantine directory
- File deletion confirmation
- SQLite integration for persistent state
- File history tracking
- Duplicate group management
- Settings window
- Scan progress indicator
- Multiple monitor directory support
- Filtering and search in report window
- Run engine as Windows service
- Auto-start with system
- Service control from GUI
make clean
set CFLAGS=-Wall -Wextra -g -Iinclude -Iblake
make all- Engine detects duplicate in
check_for_duplicate() - Calls
send_alert_duplicate_detected() - Builds JSON message
- Writes to named pipe via
send_message() - GUI's
PipeReaderThread()receives message - Parses JSON with
ParseAlertJSON() - Shows notification with
ShowTrayNotification()
- Add enum in
ipc_pipe.h - Create sender function in
ipc_pipe.c - Add parser case in
gui_tray.c::PipeReaderThread()
MIT License - Feel free to modify and distribute.
Developed for real-time duplicate file detection and user notification.
Happy duplicate detecting! π