Re: Seeking for files ending with '.txt' ..
| From: | Henrik Hansen | Date: | Tue, 13 Mar 2001 22:47:12 +0000 |
| Subject: | Re: Seeking for files ending with '.txt' .. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-43723@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "Aviv Revach" <aviv_r@brillianet.com>
To: <php-general@lists.php.net>
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