<?php$ls=`ls -al`; //get all the filesecho $ls; $content=explode(" ",$ls); // put all the files in an array foreach($i=0; $content[$i]< count($content); $i++){ //iterate through the files to check what type it isecho $content[$i];if(is_dir($content[$i])){ //see if the file is a directory echo "$content[$i] is a directory its contents are { "; $handle=opendir($content[$i]); //open directory to read $read=readdir($handle); closedir($handle)$display_read=explode("\n",$read);foreach($display_read as $arr){ echo $arr; } }else{ echo "$content[$i] \n"; }}?>