1
2
3
4
5
6
7
8
9
$iDir = clone $dir;
$iDir->rewind();
$filecounter = -1; // correction for the current directory
<p>while($iDir->valid()) {
	if (!$iDir->isDot()) {
		$filecounter++;
	}
	$iDir->next();
}