note 70567 deleted from function.readdir by tularis
| From: | tularis@php.net | Date: | Sun, 13 May 2007 18:59:12 +0000 |
| Subject: | note 70567 deleted from function.readdir by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126501@lists.php.net to get a copy of this message | ||
Note Submitter: Adlez
----
Another way to sort files from directories.
<?php
$path = getcwd();
$dh = opendir($path);
print "Directories <br>************************* <br>";
while (($dir = readdir($dh)) !== false) {
if ( $dir != "." && $dir != ".." ){
$file = @fopen("$path/$dir", "r");
if (!$file){
print "<a href='$dir'>$dir</a><br>";
}
}
}
closedir($dh);
$path = getcwd();
$dh = opendir($path);
print "<br>Files <br>************************* <br>";
while (($dir = readdir($dh)) !== false) {
if ( $dir != "." && $dir != ".." ){
$file = @fopen("$path/$dir", "r");
if ($file){
print "<a href='$dir'>$dir</a><br>";
}
}
}
closedir($dh);
?>