This commit is contained in:
2026-02-08 12:28:54 +01:00
parent dbc60ee42b
commit e7dd89962e
10 changed files with 249 additions and 1 deletions

21
indexer/scanner.py Normal file
View File

@@ -0,0 +1,21 @@
import os
from datetime import datetime
from indexer.hasher import blake3_file
def scan_files(root_path):
for root, _, files in os.walk(root_path):
for name in files:
full_path = os.path.join(root, name)
try:
stat = os.stat(full_path)
except FileNotFoundError:
continue
yield {
"full_path": full_path.replace("\\", "/"),
"file_name": name,
"directory": root.replace("\\", "/"),
"size": stat.st_size,
"mtime": datetime.fromtimestamp(stat.st_mtime),
"content_hash": blake3_file(full_path),
}