note 108229 added to function.scandir

From: Date: Mon, 09 Apr 2012 18:52:44 +0000
Subject: note 108229 added to function.scandir
Groups: php.notes 
Request: Send a blank email to php-notes+get-187031@lists.php.net to get a copy of this message
/** * This function will scan all files recursively in the sub-folder and folder. * * @author Fazle Elahee * */ function scanFileNameRecursivly($path = '', &$name = array() ) { $path = $path == ''? dirname(__FILE__) : $path; $lists = @scandir($path); if(!empty($lists)) { foreach($lists as $f) { if(is_dir($path.DIRECTORY_SEPARATOR.$f) && $f != ".." && $f != ".") { scanFileNameRecursivly($path.DIRECTORY_SEPARATOR.$f, &$name); } else { $name[] = $path.DIRECTORY_SEPARATOR.$f; } } } return $name; } $path = "/var/www/SimplejQueryDropdowns"; $file_names = scanFileNameRecursivly($path); echo "<pre>"; var_dump($file_names); echo "</pre>"; ---- Server IP: 69.147.83.197 Probable Submitter: 86.31.61.186 ---- Manual Page -- http://www.php.net/manual/en/function.scandir.php Edit -- https://master.php.net/note/edit/108229 Del: integrated -- https://master.php.net/note/delete/108229/integrated Del: useless -- https://master.php.net/note/delete/108229/useless Del: bad code -- https://master.php.net/note/delete/108229/bad+code Del: spam -- https://master.php.net/note/delete/108229/spam Del: non-english -- https://master.php.net/note/delete/108229/non-english Del: in docs -- https://master.php.net/note/delete/108229/in+docs Del: other reasons-- https://master.php.net/note/delete/108229 Reject -- https://master.php.net/note/reject/108229 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#187031) next »