> From: [EMAIL PROTECTED]
>
> I am a newbie so be kind
>
> I have looked into the manual about directory functions etc.
>
> I want to return all the files from a directory into a array.
>
> Could some one give me a few pointers or something?
>
> I keep getting confused but I have used google and the manual.
>
> I can find functions but I am not sure how I can list the files into an array.
$current_dir = "/whatever/";
$dir = opendir($current_dir);
// declare some arrays to put the directory into
$dirs = array();
$files = array();
// move the directory into an array
while ($file = readdir($dir))
{
if ($file == '.' || $file == '..')
{
continue;
}
else
{
if (is_dir($file))
array_push($dirs, $file);
else
array_push($files, $file);
}
}
--
Lowell Allen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php