For example, if you want to show all files under a directory containing both files and subdirectories.
<?PHP $dir = "/usr/"; if ($handle = opendir($dir)) { while (false !== ($entry = readdir($handle))) { $file = $dir . "$entry"; if (is_file($entry)) echo "$entry is a file\n"; } } ?>
<?PHP $dir = "/usr/"; if (is_dir($dir)) echo "$dir is a directory\n"; ?>