Forum Moderators: coopster

Message Too Old, No Replies

dir indexing

missing files

         

WhosAWhata

11:53 pm on Apr 20, 2004 (gmt 0)

10+ Year Member



I have a folder "archives" full of folders for every month (Jan04,Feb04,...) this script is supposed to add them to an array but it doesn't. DID I DO SOMETHING WRONG?

$dir = "archives/";
$d = opendir($dir);
while(false!== ($f = readdir($d))) {
if (is_dir($f) && ($f!= ".") && ($f!= "..")) {
echo $f."<br>";
$folders[] = $f;
}
}

coopster

9:17 pm on Apr 21, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Looks fine to me. Where are you running the script from? If the script is actually in the
archives
folder, try this...
$dir = "../archives";
...otherwise it's just your path in the
$dir
variable that is giving you fits.

WhosAWhata

11:36 pm on Apr 21, 2004 (gmt 0)

10+ Year Member



no, i know the path is right
o well i'll tamper with it later
btw
i also tried
$dir="archives/";
$d = dir(dir);
while($f = $d->read()) {
if (is_dir($f) && ($f!= ".") && ($f!= "..")) {
echo $f."<br>";
$folders[] = $f;
}
}
$d->close();
that didn't work either

coopster

1:24 pm on Apr 22, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



If it's not the path, then perhaps it's a permissions issue. I tested it and it runs fine for me, as long as the path is correct.