note 42162 added to function.readdir

From: Date: Wed, 05 May 2004 21:10:50 +0000
Subject: note 42162 added to function.readdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-69260@lists.php.net to get a copy of this message
Another simple recusive directory listing function. <?php $BASEDIR="/tmp"; function recursedir($BASEDIR) { $hndl=opendir($BASEDIR); while($file=readdir($hndl)) { if ($file=='.' || $file=='..') continue; $completepath="$BASEDIR/$file"; if (is_dir($completepath)) { # its a dir, recurse. recursedir($BASEDIR.'/'.$file); print "DIR: $BASEDIR/$file<br>\n"; } else { # its a file. print "FILE: $BASEDIR/$file<br>\n"; } } } recursedir($BASEDIR); ?> ---- Manual Page -- http://www.php.net/manual/en/function.readdir.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+42162 Delete -- http://master.php.net/manage/user-notes.php?action=delete+42162&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+42162&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#69260) next »