How to get all folders and files in uploads folder programmatically

What I want to do is to get the folders under the PDF folder from the wp-content/uploads/pdfs folder from my site.
Screenshot 1-Project Zealous
Inside those folders are multiple files that I want to display on frontend.
Screenshot 2-Project Zealous
Here is how I managed to get those directories and the pdf files inside them.
                

$upload_dir = wp_upload_dir();
$folder = $upload_dir[‘basedir’];

// THIS IS TO GET ALL FOLDERS FOUND ON THE DIRECTORY

//In this example, I only want to get the folders under /wp-content/uploads/pdfs
$issues = scandir( $folder.’/pdfs’ );

//check if the folders are showing
echo ‘<pre>’;
print_r($issues);
echo ‘</pre>’;

        
                

//THIS IS TO GET ALL THE FILES ON THE FOLDERS I HAVE FETCHED ABOVE
foreach( $issues as $issue ){
$articles = scandir( $folder.’/pdfs/’.$issue );

//check if the files are showing
echo ‘<pre>’;
print_r($articles );
echo ‘</pre>’;

foreach( $articles as $article ){
echo home_url( ‘wp-content/uploads/pdfs/’.$issue.’/’.$article ).'<br>’;
}

}

        
Screenshot 4-Project Zealous