I have Folder Named A, which includes some Sub-Folders starting name with Alphabet A. In these Sub-Folders different images are placed (some of the image formats are .png, jpeg, .giff and .webp, having different names like item1.png, item1.jpeg, item2.png, item3.png etc). From these Sub-Folders I want to get list of path of those images which endswith 1. Along with that I want to only get 1 image file format like for example only for jpeg. In some Sub-Folders images name endswith 1.png, 1.jpeg, 1.giff and etc. I only want one image from every Sub-Folder which endswith 1.(any image format). I am sharing the code which returns image path of items (ending with 1) for all images format.
CODE: