how to display images from a folder in a cdn to wordpress website

i have a ecommerce website that has around 2500 products plus its variations. we sell clothes and we have all the images for these products categorized in their separate folders. we have over 5000 images. these folders are named the same as the SKU of the product. what i would like to do is display these images from the folders as product gallery images for each product. is there any way i can do this without having to manually insert a URL for each image within each folder? what i would like to achieve is to show only the URL of the folder where the images are in but for the images in that folder to be displayed on the product page. if so how do i go about doing this. if not what is the best way to tackle this.