How to list all files in a directory? I need to store the names of all .txt files in an array so I can open them one by one and search for a particular string
Thank you,
Johan Tibell, Webmaster & Programmer
<?
$dir_name="/usr/local/apache/secure/$custkey/data"; $dir=opendir($dir_name);
while ( $filename = readdir($dir) ) { $bits=explode(".", $filename); if ( $bits[1] == "txt" ) { $files[]=$filename; } }
closedir($dir);
?>