Jump to content

is_dir not working.


mandrill

Recommended Posts

The is-dir function isn't recognising a directory. here's the code:
[code]<?php

/* Keiths Gallery Project
Purpose: To dynamically list files and directories and display them as galleries on my website
Step one: define variables */
$rootdir="the/directory/i/want/read";
// Step two: generate array of subdirectories of the directory. These will be my galleries organised according to subject matter
$dh=opendir($rootdir);
while ($filename = readdir($dh))
{
$rootdircont[] = $filename;
}
foreach($rootdircont as $image)
{
echo"$image";
var_dump(is_dir($image));
echo"</br>";
}
echo"$</br>";
$counter = 0 ;
foreach ($rootdircont as $file)
{
if ( is_dir($file))
{
$counter ++ ;
echo "$counter: $file</br>";
$galarray[$counter] = $file;
}
}
/* test echo of above */
echo '</br>';
foreach ($galarray as $galdir)
{
echo "$galdir</br>";
}
?>[/code]
here's the output:
[code].bool(true)
..bool(true)
atomfeedbtn.pngbool(false)
readme.txtbool(false)
43things.pngbool(false)
ap-search-go-btn.gifbool(false)
arthurbool(false)      <-------------- This is a directory but its not being recognised as one.
bc80x15gold.gifbool(false)
blogoramabutton.gifbool(false)
button_sm_1.gifbool(false)
deliciousbutt.pngbool(false)
firefox_80x15.pngbool(false)
goblink.gifbool(false)
icon_scotland_80x15.gifbool(false)
index.htmlbool(false)
lcabutton.pngbool(false)
onepointthreebanner.jpgbool(false)
popdexbtn.pngbool(false)
right2writebtn.pngbool(false)
rssfeedbtn.pngbool(false)
scotblogsbtn.gifbool(false)
Thumbs.dbbool(false)
ucrated.pngbool(false)
ucv12title.jpgbool(false)
wika-blogbtn.pngbool(false)
Cloud.pngbool(false)
button6.gifbool(false)
Dawn_Of_Skirmish_v1.6_AI_Mod_Install.exebool(false)
egobutton.pngbool(false)
searchbox-logo-126x32.gifbool(false)
zardozzbtn.pngbool(false)
logo_80x15.gifbool(false)
libertybutt.pngbool(false)
wp-logos-buttons.jpgbool(false)
wp-button-3.pngbool(false)
tn-tiny.gifbool(false)
$
1: .[/code]

Its probably something really stupid but I'd appreciate it if someone could point it out to me, cos I've been staring at it for hours and getting nowhere.
thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.