hey!

this is the code I'm using to get into array all filenames in a directory:

----------------------------------------------------------------
$mydir = mydir //the directory name
$output_file = fopen($data_file, "w");
$begin = "<?
\$files_name = array(";

fwrite($output_file, $begin);

$output_file = fopen($data_file, "w");
if ($handle = opendir('./$mydir/')) {
    while (false !== ($filename = readdir($handle))) {
        if ($file != "." && $filename != "..") { //&& !is_dir($filename)
can be added
            $element = "\"$filename\",";
            fwrite($output_file, $element);
        }
    }
    closedir($handle);
}
fwrite($output_file,"\"\");\r\n");
fwrite($output_file, "?>");
fclose($output_file);

chmod($output_file, 0777); //to preview

echo "the list has been succesfully created";
----------------------------------------------------------------

now, how can I make the script to look into subdirectories of ./$mydir/
and output also those filenames into the same or another array?

thank you

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to