scr/duplicate_check.py

23 lines
512 B
Python
Raw Normal View History

#!/usr/bin/env python
2025-06-25 21:28:54 +00:00
# Duplicate Check
2025-06-25 21:45:09 +00:00
# Version: 0.11.0
2025-06-25 21:28:54 +00:00
2025-06-25 21:30:25 +00:00
# Copyright 2025 Jake Winters
2025-06-25 21:36:04 +00:00
# SPDX-License-Identifier: BSD-3-Clause
import os
2025-06-25 21:37:13 +00:00
import hashlib
2025-06-25 21:43:39 +00:00
import argparse
2025-06-25 21:45:09 +00:00
parser = argparse.ArgumentParser(description='Scan directory for duplicate files and delete them.')
def hash_file(file_path):
sha256_hash = hashlib.sha256()
with open(file_path, 'rb') as f:
for byte_block in iter(lambda: f.read(65536), b''):
sha256_hash.update(byte_block)
2025-06-25 21:43:39 +00:00
return sha256_hash.hexdigest()