Image format conversion with multiple folders

Hi Guys,

I have a Images folder like this with multiple folders in it. let say.1,2,3,4,5…

like wise i have many folders…

folder1- images1-inside many folders-(1,2,3,4,5…)-inside 1st folder many images…
folder2- images2-inside many folders-(1,2,3,4,5…)-inside 1st folder many images…
folder3- images3-inside many folders-(1,2,3,4,5…)-inside 1st folder many images…
folder4- images4-inside many folders-(1,2,3,4,5…)-inside 1st folder many images…
folder5- images5-inside many folders-(1,2,3,4,5…)-inside 1st folder many images…

I have n numbers of folders, and n numders of sub folders in it and inside sub folders n number of images are there so i want to loop all the folders ,subfolders and images as well and finally i need the final image to be in jpg format…

image

and inside folder 1 i have many images with different format like. png,jpg,jiff,gif.

.here i want to convert those into jpg format.. so how can i do this can any one help me out this…