Files
troupe-standup/wizard-work/spark/duplicate_find_verification.md
T

58 lines
1.6 KiB
Markdown

# Duplicate Finder Script - Verification Report
## Artifact Created
**File:** /root/.hermes/wizard-outputs/spark/duplicate_finder.py
**Size:** 2041 bytes
**Syntax:** Verified OK (lint pass)
## Script Purpose
A Python utility to find duplicate files by SHA-256 content hash. Useful for identifying redundant files across directories.
## Verification Results
### Test 1: Clean directory scan
```
$ python3 duplicate_finder.py /root/.hermes/wizard-outputs/spark 1
No duplicates found in /root/.hermes/wizard-outputs/spark (depth <= 1)
```
**Status:** Script executed without errors (exit code 0)
### Test 2: Duplicate detection
Created test directory with actual duplicates:
```bash
$ mkdir -p /tmp/dup_test
$ echo "hello world" > /tmp/dup_test/file_a.txt
$ echo "hello world" > /tmp/dup_test/file_b.txt
```
Ran scan:
```
$ python3 duplicate_finder.py /tmp/dup_test 1
Found 1 duplicate group(s):
[hash: a948904f2f0f...]
/tmp/dup_test/file_a.txt (12 bytes)
/tmp/dup_test/file_b.txt (12 bytes)
```
**Status:** Detected correct duplicate pair with matching hash
## Usage
```bash
python3 duplicate_finder.py <directory> [max_depth]
```
- `directory`: Path to search
- `max_depth`: Maximum directory depth (default: 2)
## Features
- SHA-256 content hashing
- Configurable max depth to avoid deep scans
- Skips hidden files and __pycache__
- Outputs file size for verification
- Handles permission errors gracefully
## Evidence Summary
- Script file written and verified: OK
- Linting passed: OK
- Execution test 1 passed: No duplicates in clean dir
- Execution test 2 passed: Found expected duplicate pair
- Hash verification: Both duplicate files matched (a948904f2f0f...)