from pathlib import Path
import shutil

# Put your main folder path here
SOURCE_FOLDER = Path(r"C:\Users\Designer\Downloads\D-275\6TH")

# Subfolder inside same source folder
DEST_FOLDER = SOURCE_FOLDER / "1_images"

# Allowed extensions
VALID_EXTENSIONS = {".jpg", ".jpeg", ".png", ".webp"}

# Create subfolder if not exists
DEST_FOLDER.mkdir(exist_ok=True)

moved = 0
skipped = 0

for file_path in SOURCE_FOLDER.iterdir():
    if file_path.is_file():
        ext = file_path.suffix.lower()
        name_without_ext = file_path.stem

        # Move only files ending with 1
        if ext in VALID_EXTENSIONS and name_without_ext.endswith("1"):
            target_path = DEST_FOLDER / file_path.name

            if target_path.exists():
                print(f"SKIPPED (already exists): {file_path.name}")
                skipped += 1
                continue

            shutil.move(str(file_path), str(target_path))
            print(f"MOVED: {file_path.name}")
            moved += 1

print("\nDone")
print(f"Moved: {moved}")
print(f"Skipped: {skipped}")