#!/usr/bin/env python3 """ Run this first, before the GUI or batch tool exist. It only reads your filesystem - it never renames or moves anything. Point it at a real folder (start small, e.g. just 03_PRIVAT, not the whole 711-file vault) and check: - does the file count look right (junk correctly excluded)? - does the date guess look reasonable as a STARTING point? - does the "already conventioned" count match what you'd expect? Usage: python3 preview_scan.py /path/to/folder """ import sys from pathlib import Path from core import scan, discover_folders def main(): if len(sys.argv) != 2: print("Usage: python3 preview_scan.py /path/to/folder") sys.exit(1) root = Path(sys.argv[1]).expanduser().resolve() if not root.is_dir(): print(f"Not a directory: {root}") sys.exit(1) records = scan(root) folders = discover_folders(root) already = sum(r.name_matches_convention for r in records) near = sum(r.near_miss for r in records) untouched = len(records) - already - near print(f"Scanned: {root}") print(f"Files found (junk excluded): {len(records)}") print(f" already conventioned: {already}") print(f" near-miss date format: {near}") print(f" untouched: {untouched}") print(f"Destination folders found: {len(folders)}") print() print("First 20 files:") for r in records[:20]: flag = "OK " if r.name_matches_convention else ("~ " if r.near_miss else " ") print(f" [{flag}] {r.fs_date} {r.rel_path}") if len(records) > 20: print(f" ... and {len(records) - 20} more") if __name__ == "__main__": main()