import os
import shutil

# source folder
source_dir = r"C:\Users\luctr\AppData\Roaming\Elgato\StreamDeck\ProfilesV2"

# destination folder
dest_dir = r"\\BOXICUBE\home\Photos\icons\streamdeck"

# create destination folder if not exists
os.makedirs(dest_dir, exist_ok=True)

# walk through directories
for root, dirs, files in os.walk(source_dir):
    for file in files:
        if file.lower().endswith((".png", ".jpg", ".jpeg")):
            src_path = os.path.join(root, file)
            # make sure filenames are unique in backup
            rel_path = os.path.relpath(src_path, source_dir).replace("\\", "_")
            dest_path = os.path.join(dest_dir, rel_path)
            shutil.copy2(src_path, dest_path)
            print(f"Saved: {dest_path}")

print("All PNG and JPG files have been copied.")
input("Press Enter to close...")
