I have already created a function to recursively go through a directory(also its sub-folders) and retrieve all the files with a specific extension.
function
directory