Posted by -Lost on 07/03/06 08:08
"dimo414" <dimo414@gmail.com> wrote in message
news:1151911060.811959.112520@m79g2000cwm.googlegroups.com...
> . ~ 1
> .. ~ 1
> 001 ~
> 002 ~
> 003 ~
> 004 ~
>
> The files 001-004 are all folders, and yet they do not seem to pass
> is_dir(). I could not find anything on <a
> href="http://us3.php.net/is_dir">PHP.net</a> and I'm at a loss.
Because you are testing whether is_dir('001'), not whether is_dir('subfolder/001').
I changed it to something like:
$_directory = 'js';
$directory = dir($_directory);
while (false !== ($file = $directory->read()))
{
print $file . ' ~ ' . is_dir($_directory . '/' . $file) . '<br />' . "\n";
}
....and got:
.. ~ 1
... ~ 1
array.htm ~
array.js ~
auto_resize ~ 1
highlight.htm ~
jsnow.gif ~
kids ~ 1
no_js.htm ~
no_js.js ~
no_right_click.htm ~
onclick.htm ~
onclick.js ~
print.htm ~
print.js ~
prot.htm ~
quirksmode.js ~
referer-sic.php ~
resolution.php ~
watermark.htm ~
Basically just test the correct folder, subfolder pattern. This of course would even work
if you declared $_directory = 'subfolder/sub-subfolder/sub-sub-subfolder'; et cetera.
(You could even remove the . '/' . if you put a / at the end of your $_directory
variable.)
Hope this helps.
-Lost
Navigation:
[Reply to this message]
|