solved ...
$mydirb ="/tmp"; # starting directory
if (file_exists($mydirb) ) {
$dir="$mydirb";
$a = `find $dir -depth -type f -print`;
$files = @explode ("\n", $a);
}
else
{
}
if(is_array($files)){
sort($files);
foreach($files as $file){
if ( $file !="") {
if( preg_match( "/\.c/" , $file ) ) { # find *.c files
$cfilecounter = $cfilecounter + 1 ; # counts *.c files
}
echo "<b>$file</b><br>"; # list files on current directory and subdirectories
}
}
}