Using the glob() Function
<?php
$directories = glob("/tmp/*", GLOB_ONLYDIR);
$complete = glob("/tmp/*");
$files = array_diff($directories, $complete);
echo "Directories in /tmp/<BR>";
foreach($directories as $val) {
echo "$val<BR>\n";
}
echo "<BR>Files in /tmp/<BR>";
foreach($files as $val) {
echo "$val<BR>\n";
}
?>
Related examples in the same category