function get_file_list($dirName=".") {
 $list = array();
 $handle = opendir($dirName);
 while (false !== ($file = readdir($handle))) {
 /* Omit the '.' and the '..' directories. */
  if ((".."== $file) || ("."== $file)) continue;
  array_push($list, $file);
 }
 closedir($handle);
 return $list;
}

Then you have an array of the filenames.
If you use rsort($array), the 5 first elements will be the 5 most recent
ones.


tommy

"Dirk Van Lyrop" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> does anybody know how to solve the following task?
>
> I'd like to generate a dynamic page, which contents come from txt-files.
> The files will be in a directory called content (from the page:
> ../content) and they are labeled with date and (within one day)
> increasing numbers,
> e.g. 20030108-1.txt, 20030108-2.txt, 20030108-3.txt, 20030109-1.txt,
> 20030110-1.txt, 20030110-2.txt
> The script should parse the file names and get the most recent five ones!
>
> The text inside should be included in the page -> but this is not the
> problem, the task mentioned above is the problem!
>
> Thx in advance for these who can deliever solutions or ideas!
>
> Dirk
>
>



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

Reply via email to