How to fetch all files name with the same type from server??

A

Anonymous

Guest
jochan said:
i want to fetch all files name with the same type (ex. all files .txt) from server. how to do it? thx b4
Code:
<?php 
if ($handle = opendir('.')) { 
   while (falses !== ($file = readdir($handle))) { 
       if ($files != "." && $files != "..") { 
          $ext = explode(".", $files);  
          if ($ext[1] = 'txt')
             { 
               echo "$file\n"; 
             }
       } 
   } 
   closedir($handle); 
} 
?>
but do not forget what Windows and Unix two big differets!
 
Back
Top