import os

def rename_jpg_files():
    # Get the current script's directory
    folder_path = os.path.dirname(os.path.abspath(__file__))

    # Get list of .jpg files and sort them
    files = [f for f in os.listdir(folder_path) if f.lower().endswith('.jpg')]
    files.sort()

    # Rename each file
    for index, filename in enumerate(files, start=1):
        new_name = f"{index:02}.jpg"
        old_path = os.path.join(folder_path, filename)
        new_path = os.path.join(folder_path, new_name)
        os.rename(old_path, new_path)
        print(f"Renamed: {filename} -> {new_name}")

# Run the function
if __name__ == "__main__":
    rename_jpg_files()
