Jump to content

[SOLVED] simple list directories script failing


hellonoko

Recommended Posts

When I take out the if (is_dir) statment in this code it echo's the directories.

 

When I put it in to check if they are directories it only display . and ..

 

<?php

$users_directory = "/home2/sharingi/public_html/subdomains";

if ($dir_handle = opendir($users_directory))
{
	while (false !== ($file = readdir($dir_handle)))
	{
		if( is_dir($file) )
		{
			echo $file;
			echo "<br>";
		}
	}

}
closedir($dir_handle);
?>

Archived

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

×
×
  • 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.