import os import shutil def pause_exit(): input("\nPress Enter to exit...") source_dir = os.path.dirname(os.path.abspath(__file__)) hex_digits = "0123456789ABCDEF" moved_count = 0 skipped_count = 0 for filename in os.listdir(source_dir): source_file = os.path.join(source_dir, filename) if not os.path.isfile(source_file): continue if not filename.lower().endswith(".zip"): continue first_digit = filename[0].upper() if first_digit not in hex_digits: print(f"Skipping {filename}: first character '{filename[0]}' is not 0-9 or A-F.") skipped_count += 1 continue folder_path = os.path.join(source_dir, first_digit) dest_file = os.path.join(folder_path, filename) os.makedirs(folder_path, exist_ok=True) if os.path.exists(dest_file): print(f"Skipping {filename}: already exists in {first_digit}\\") skipped_count += 1 continue print(f"Moving {filename} to {first_digit}\\") shutil.move(source_file, dest_file) moved_count += 1 print() print(f"Done.") print(f"Moved: {moved_count}") print(f"Skipped: {skipped_count}") pause_exit()