From 2443f4b954c1bca24b4de032b1764745adec4873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksi=20R=C3=A4s=C3=A4nen?= Date: Tue, 28 Apr 2026 18:41:57 +0300 Subject: [PATCH] Now we list all image files as we scan memory card --- photoimport.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/photoimport.py b/photoimport.py index 1725fe0..0e4d170 100644 --- a/photoimport.py +++ b/photoimport.py @@ -40,15 +40,26 @@ def scan_photos(root_dir, base_target_path): accepted_extensions = ('.jpg', '.jpeg', '.dng', '.raw', '.cr2', '.cr3', '.raf') print(f"--- Starting photo scan in: {root_dir} ---") + total_files_checked = 0 found_files = [] try: for foldername, subfolders, filenames in os.walk(root_dir): + # Count files we are about to check in this folder + num_in_folder = len(filenames) + if num_in_folder > 0 or subfolders: + rel_folder = os.path.relpath(foldername, root_dir) + print(f" Scanning: {rel_folder} ({num_in_folder} files to check)...") for filename in filenames: + total_files_checked += 1 full_path = os.path.join(foldername, filename) _, ext = os.path.splitext(filename) if ext.lower() in accepted_extensions: found_files.append(full_path) + print(f" [{len(found_files)}] {filename}") + # Progress checkpoint every 50 files checked + if total_files_checked % 50 == 0: + print(f" ...checked {total_files_checked} files, found {len(found_files)} photos so far.") except FileNotFoundError: print(f"\nFATAL ERROR: The path '{root_dir}' was not found. Please check the drive letter.") return @@ -56,6 +67,7 @@ def scan_photos(root_dir, base_target_path): print(f"\nAN UNEXPECTED ERROR OCCURRED DURING DIRECTORY TRAVERSAL: {e}") return + print(f" ...scan finished: checked {total_files_checked} total files.") if not found_files: print("\n--- Scan complete. No specified photo files found in this directory or its subdirectories. ---") return