Re: Help with is_file and is_dir

From: Date: Thu, 03 Aug 2000 21:33:11 +0000
Subject: Re: Help with is_file and is_dir
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-1535@lists.php.net to get a copy of this message
See my comments on end of lines: > Here's a snippet of code if anyone wants to help.... > > $handle = opendir($drive) ;# You need to specify path like: "A:\\" ^^^^^^ > > $fileCounter = 0 ; > $dirCounter = 0 ; > > while ($file = readdir($handle)) > { > if ($file != "." && $file != "..")#I don't think you need that > { > if (is_file($file) )# Should be($drive.$file) ^^^^^ > { > echo "in is_file loop" ; > $allFiles[$fileCounter] = $file ; > $numFiles = sizeof($allFiles); > $fileCounter++ ; > } > > if (is_dir($file) )# same should be ($drive.$file) ^^^^^ > { > echo "in is_dir loop" ; > $allDirs[$dirCounter] = $file ; > $numDirs= sizeof($allDirs); > $dirCounter++ ; > } > } > } > > closedir($handle); Hope it will work now! Alain

« previous php.windows (#1535) next »