note 59440 deleted from function.scandir by felipe
| From: | felipe@php.net | Date: | Fri, 29 Aug 2008 23:23:59 +0000 |
| Subject: | note 59440 deleted from function.scandir by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-143995@lists.php.net to get a copy of this message | ||
Note Submitter: sk3391 at gmail dot com
----
Here is a little script that i through together to count the files in my directory while excluding
the "." i hope it helps you out!
<?
$dir = ".";
$sort = 0;
$dir_open = @ opendir($dir);
while (($dir_content = readdir($dir_open)) !== false)
$files[] = $dir_content;
if ($sort == 1) {
rsort($files, SORT_STRING);
} else {
sort($files, SORT_STRING);
}
$a=0;
$b=10;
$file_s="";
while($a < $b) {
$c=1;
$d=5;
while($c < $d) {
$dot[$c.",".$a]=str_repeat(".", $c);
if($files[$a] == $dot[$c.",".$a]) {
unset($files[$a]);
} else {
}
$c++;
}
if($files[$a] != "") {
$brake[$a]="<br>";
} else {
$brake[$a]="";
}
$file_s.=$files[$a].$brake[$a];
$a++;
}
echo $file_s;
echo "<br><br><br>";
echo count($files);
?>