note 39772 deleted from class.dir by tomsommer

From: Date: Tue, 10 Feb 2004 16:19:46 +0000
Subject: note 39772 deleted from class.dir by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-64966@lists.php.net to get a copy of this message
Note Submitter: me@NODIRT.dirtbox.com ---- If you want to limit the number of levels the directory traverses, do this: <?php function getDirList ($dirName,$numlevels) { $thislevel = $numlevels; echo $dirName."<br>\n"; $d = dir($dirName); while($entry = $d->read()) { if ($entry != "." && $entry != "..") { if (is_dir($dirName."/".$entry) && $thislevel) { $thislevel--; getDirList($dirName."/".$entry, $thislevel); } else { echo $dirName."/".$entry."<br>\n"; } } } $d->close(); } // for example, limit to 3 levels: getDirList(".",3); ?> Jungle www.mailboxmovies.com

« previous php.notes (#64966) next »