For looping all files in a directory, I created this code in php :
$dir = new DirectoryIterator(dirname(__FILE__));
$files = scandir($dir.'/');
foreach($files as $file)
{
echo $file;
echo "\n";
}
However I am not able to list all files inside multiple subdirectory of a directory.