Add a option to delete each input folder after each output of that folder is finished  here is code import os
import shutil
import threading
from tkinter import (
    Tk,
    Button,
    Label,
    filedialog,
    messagebox,
    StringVar,
)
from tkinter.ttk import Progressbar, Combobox
from concurrent.futures import ThreadPoolExecutor

class ImageRenamerCombinerGUI:
    def __init__(self, root):
        self.root = root
        self.root.title("Image Renamer & Combiner")
        self.root.geometry("500x400")
        self.root.resizable(False, False)

        self.source_folders = []
        self.destination_folder = ""
        self.mode = StringVar()
        self.prefix = StringVar()

        # Source Folders Selection
        self.btn_select_sources = Button(
            root, text="Select Source Folders", command=self.select_source_folders
        )
        self.btn_select_sources.pack(pady=10)

        self.lbl_sources = Label(root, text="No source folders selected.")
        self.lbl_sources.pack()

        # Destination Folder Selection
        self.btn_select_destination = Button(
            root, text="Select Destination Folder", command=self.select_destination_folder
        )
        self.btn_select_destination.pack(pady=10)

        self.lbl_destination = Label(root, text="No destination folder selected.")
        self.lbl_destination.pack()

        # Mode Selection
        self.lbl_mode = Label(root, text="Select Renaming Mode:")
        self.lbl_mode.pack(pady=5)

        self.cmb_mode = Combobox(
            root,
            textvariable=self.mode,
            state="readonly",
            values=[
                "Add Custom Prefix",
                "Sequential Numbering",
                "Prefix Based on Folder",
            ],
        )
        self.cmb_mode.current(0)
        self.cmb_mode.pack(pady=5)
        self.cmb_mode.bind("<<ComboboxSelected>>", self.on_mode_change)

        # Prefix Entry (Visible only for "Add Custom Prefix")
        self.frame_prefix = Label(root, text="Enter Prefix:")
        self.entry_prefix = Button(root, textvariable=self.prefix)  # Placeholder for prefix entry

        self.entry_prefix = Button(root, text="", command=lambda: None)  # To initialize
        self.prefix_entry = Button(root)  # Placeholder

        self.entry_prefix = Button(root)  # Reinitialize
        self.prefix_entry_var = StringVar()
        self.prefix_entry = Button(root)  # Reinitialize

        # Correct prefix entry
        self.prefix_entry = None

        self.lbl_prefix = None
        self.entry_prefix_widget = None

        self.create_prefix_entry()

        # Combine and Rename Button
        self.btn_start = Button(
            root, text="Start Processing", command=self.start_processing
        )
        self.btn_start.pack(pady=20)

        # Progress Bar
        self.progress = Progressbar(root, orient="horizontal", length=400, mode="determinate")
        self.progress.pack(pady=10)

    def create_prefix_entry(self):
        """Creates the prefix entry widget if the mode is 'Add Custom Prefix'."""
        if self.mode.get() == "Add Custom Prefix":
            if not self.entry_prefix_widget:
                self.lbl_prefix = Label(self.root, text="Enter Prefix:")
                self.lbl_prefix.pack(pady=5)
                self.entry_prefix_widget = Button(self.root, text="", command=lambda: None)
                self.entry_prefix_widget = Button(self.root)  # Placeholder

                self.entry_prefix_widget = Button(self.root)  # Reinitialize

                # Correct implementation using Entry
                from tkinter import Entry
                self.prefix_entry_widget = Entry(self.root, textvariable=self.prefix, width=30)
                self.prefix_entry_widget.pack(pady=5)
        else:
            if self.entry_prefix_widget:
                self.prefix_entry_widget.destroy()
                self.prefix_entry_widget = None
                self.lbl_prefix.destroy()

    def on_mode_change(self, event):
        """Handles the UI changes when the renaming mode is changed."""
        self.create_prefix_entry()

    def select_source_folders(self):
        """Allows the user to select multiple source folders."""
        folders = filedialog.askdirectory(mustexist=True, title="Select a Source Folder")
        if folders:
            if folders not in self.source_folders:
                self.source_folders.append(folders)
                self.lbl_sources.config(text=f"Selected {len(self.source_folders)} source folder(s).")
            else:
                messagebox.showinfo("Duplicate Folder", "This folder has already been selected.")
            # Ask if the user wants to select another folder
            another = messagebox.askyesno("Select Another", "Do you want to select another source folder?")
            if another:
                self.select_source_folders()

    def select_destination_folder(self):
        """Allows the user to select the destination folder."""
        folder = filedialog.askdirectory(mustexist=True, title="Select Destination Folder")
        if folder:
            self.destination_folder = folder
            self.lbl_destination.config(text=f"Destination: {self.destination_folder}")

    def start_processing(self):
        """Starts the processing in a separate thread."""
        if not self.source_folders:
            messagebox.showwarning("No Source Folders", "Please select source folders first.")
            return
        if not self.destination_folder:
            messagebox.showwarning("No Destination Folder", "Please select a destination folder.")
            return
        if self.mode.get() == "Add Custom Prefix" and not self.prefix.get():
            messagebox.showwarning("No Prefix", "Please enter a prefix for renaming.")
            return

        # Disable the start button to prevent multiple clicks
        self.btn_start.config(state="disabled")

        # Start the processing in a separate thread
        threading.Thread(target=self.process_files, daemon=True).start()

    def process_files(self):
        """Processes the files based on the selected mode."""
        try:
            file_operations = []
            total_files = 0

            # Gather all image files from source folders
            for src_folder in self.source_folders:
                for root_dir, _, files in os.walk(src_folder):
                    for file in files:
                        if self.is_image_file(file):
                            total_files += 1
                            src_file = os.path.join(root_dir, file)
                            file_operations.append(src_file)

            if total_files == 0:
                messagebox.showinfo("No Images Found", "No image files were found in the selected source folders.")
                self.reset_ui()
                return

            # Initialize progress bar
            self.progress["maximum"] = total_files
            self.progress["value"] = 0

            # Determine renaming strategy
            if self.mode.get() == "Add Custom Prefix":
                renamed_files = self.add_custom_prefix(file_operations)
            elif self.mode.get() == "Sequential Numbering":
                renamed_files = self.sequential_numbering(file_operations)
            elif self.mode.get() == "Prefix Based on Folder":
                renamed_files = self.prefix_based_on_folder(file_operations)
            else:
                renamed_files = []

            # Copy files to destination folder
            with ThreadPoolExecutor(max_workers=os.cpu_count() or 4) as executor:
                futures = []
                for src, dest in renamed_files:
                    futures.append(executor.submit(self.copy_file, src, dest))

                for idx, future in enumerate(futures, start=1):
                    future.result()  # To catch exceptions if any
                    self.progress["value"] = idx
                    self.root.update_idletasks()

            messagebox.showinfo("Success", f"Successfully processed {total_files} images into {self.destination_folder}.")
        except Exception as e:
            messagebox.showerror("Error", f"An error occurred: {e}")
        finally:
            self.reset_ui()

    def reset_ui(self):
        """Resets the UI elements after processing."""
        self.btn_start.config(state="normal")
        self.progress["value"] = 0

    def add_custom_prefix(self, file_list):
        """Adds a custom prefix to each file."""
        prefix = self.prefix.get()
        renamed = []
        for src in file_list:
            filename = os.path.basename(src)
            new_filename = f"{prefix}{filename}"
            dest = os.path.join(self.destination_folder, new_filename)
            renamed.append((src, dest))
        return renamed

    def sequential_numbering(self, file_list):
        """Renames files with sequential numbering."""
        renamed = []
        count = 0
        for src in sorted(file_list):
            ext = os.path.splitext(src)[1]
            new_filename = f"{count:05d}{ext}"
            dest = os.path.join(self.destination_folder, new_filename)
            renamed.append((src, dest))
            count += 1
        return renamed

    def prefix_based_on_folder(self, file_list):
        """Prefixes filenames based on their source folder name."""
        renamed = []
        for src in file_list:
            folder_name = os.path.basename(os.path.dirname(src))
            filename = os.path.basename(src)
            new_filename = f"{folder_name}_{filename}"
            dest = os.path.join(self.destination_folder, new_filename)
            renamed.append((src, dest))
        return renamed

    def copy_file(self, src, dest):
        """Copies a file from src to dest."""
        os.makedirs(os.path.dirname(dest), exist_ok=True)
        shutil.copy2(src, dest)

    @staticmethod
    def is_image_file(filename):
        """Checks if a file is an image based on its extension."""
        image_extensions = ('.png', '.jpg', '.jpeg', '.bmp', '.gif', '.tiff', '.webp')
        return filename.lower().endswith(image_extensions)

def main():
    root = Tk()
    app = ImageRenamerCombinerGUI(root)
    root.mainloop()

if __name__ == "__main__":
    main()