Jump to content

is_dir() issue


music_lp90

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...