Re: different operations on files than dirs
| From: | Ignacio Vazquez-Abrams | Date: | Thu, 16 Nov 2000 06:46:11 +0000 |
| Subject: | Re: different operations on files than dirs | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-25637@lists.php.net to get a copy of this message | ||
On Thu, 16 Nov 2000, Kevin Ferron wrote:
> I'm stuck.. variations on the following code is what I've been trying:
>
> $handle=opendir($this->dirshow);
> while (false!==($file = readdir($handle))) {
> if ($file != "." && $file != "..") {
> if (is_dir($file) == 1) {
>
> STUFF I WANT TO HAPPEN IF ITS A DIR
> }
>
> elseif (is_dir($file) == 0) {
> IF ITS A FILE
> }
>
> Thanks for your help.
>
> phool
>
Try this:
...
$handle=opendir($this->dirshow);
while (!($file=readdir($handle)))
if ($file!="." and $file!="..")
if (is_dir($file))
{
// dir stuff
}
else
{
// file stuff
};
closedir($handle);
...
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>