----- Original Message -----
From: "Aviv Revach" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 12, 2001 10:01 PM
Subject: [PHP] Seeking for files ending with '.txt' ..
> Hey!
>
> I have a directory that contains many files. Some of these files have a
> '.txt' ending.
> I would like to know how could I locate each one of the '.txt' files.
>
> For each file I find, I need to do a certain action, and should continue
> the search.
$dh = opendir("/tmp");
while( $file = readdir($dh)) {
if ($file != "." && $file != ".."{
ereg("[.]([a-z]{2,3})$", $file, $extention);
if($extention == ".txt")
echo "yehaa file ends with .txt";
else
echo "darn no .txt";
}
}
or something like that
--
Henrik Hansen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]