For get list of all file from folder you have to use following script.
If you have three file and five folders in your current folder then it will render only three files.
$folderPath = "fileadmin/images/" $files = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($folderPath, '', true, 1, '');
After print of that result Output will look like below
Array ( [82141013ca93e10552e65da03ea89014] => fileadmin/images/jainish.jpg [514f220a8ceb5d13971e6fddf5a06f0c] => fileadmin/images/senjaliya.jpg [5ee9823729a422345befd96d2ece6b69] => fileadmin/images/jainish.txt )
You will get all files list in array.
Note : It will not render folders. its only render list of all files with different extension.
If you have any queries, please do not hesitate to contact me at Jainish Senjaliya