Loop through each folder and merge variable number of images into 1 pdf for each folder

Hello.

I have folders and within each folder there are any number of images from 1-hundreds.
I have tried numerous For Each attempts but am unable to read and merge images for more than 1 folder. I also need help to determine how to tell the bot to understand when folder only has 1 image but for it also to work with a folder with hundreds of images.

Thank you!

refer this,

install this below package also,

Thank you @kadiravan_kalidoss but I am trying to work on a solution I can replicate using UiPath activities and reasonable logic to help me loop through folders.

Only the last folder searched is saving the image and pdf. I need the bot to search each folder.