music_lp90 Posted September 29, 2008 Share Posted September 29, 2008 Hi, I'm trying to return the names of the directories from within a folder.Here's my code: function returnDirectories($folderName){ $dir = $folderName. "/"; $dh = opendir($dir); $i = 0; while (false !== ($filename = readdir($dh))) { $files[$i] = $filename; if(is_dir($files[$i])){ $path = $dir . $files[$i]; echo "<a href=\"$path\">". $files[$i] . " dir</a><br />"; } $i++; }} without my is_dir($files[$i]) statement, it prints out all of the directory names, but when I add the is_dir(), it only prints the "." and ".." directory. Why would this be? Folders are directories, correct?Thanks! Link to comment Share on other sites More sharing options...
justsomeguy Posted September 29, 2008 Share Posted September 29, 2008 You need to give it the full path, not just the one relative directory name. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.