note 58720 deleted from class.dir by bjori

From: Date: Fri, 14 Apr 2006 22:11:36 +0000
Subject: note 58720 deleted from class.dir by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-108112@lists.php.net to get a copy of this message
Note Submitter: dmitry dot polushkin at gmail dot com ---- Recursive function to get filesnames (with foldernames) located within subdirectories: // dmitry.info @2005 function read_dir($dir) { $array = array(); $d = dir($dir); while (false !== ($entry = $d->read())) { if($entry!='.' && $entry!='..') { $entry = $dir.$entry; if(is_dir($entry)) { $array = array_merge($array, read_dir($entry.'/')); } else { $array[] = $entry; } } } $d->close(); return $array; } Using: print_r(read_dir('/home/'));

« previous php.notes (#108112) next »