Sim Posted November 3, 2009 Posted November 3, 2009 if ($dh = opendir("downloads/")) { while ($file = readdir($dh)) { if(is_dir($file)) { if (($file <> ".") && ($file <> "..")) { echo $file; } } } closedir($dh); } i have like 15 directorys in downloads directory. it only shows like 5. why? Quote
Haunted Dawg Posted November 3, 2009 Posted November 3, 2009 In your file your using &&. Try this: if ($dh = opendir('downloads/')) { while ($file = readdir($dh)) { if(is_dir($file)) { if ($file === '.' OR $file === '..') { echo $file; } } } closedir($dh); } Quote
a_bertrand Posted November 3, 2009 Posted November 3, 2009 Nope the and (&&) is correct here. The only reason why it would show only a few of the directory is file / directory access rights. Beside that I don't see any other issues. Quote
Haunted Dawg Posted November 3, 2009 Posted November 3, 2009 Nope the and (&&) is correct here. The only reason why it would show only a few of the directory is file / directory access rights. Beside that I don't see any other issues.I tested this myself and it work's. while ($file = readdir($dh)){ if(is_dir($file)){ if ($file === '.' OR $file === '..'){ echo $file; } } } closedir($dh); Seems to work fine for me. I even set the directory differently of them folder's and it still displayed. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.