php Library
readFilenames
Keine Erläuterungen gefunden.
<?php function readFilenames($path,$extension){ /* $extension may be any file type {txt,png,...} or '*' in which case the complete sub-structure is returned as list of sub-directories and list of files. */ $fileNames=array(); $directories=array(); if (is_dir($path)) { if ($dh = opendir($path)) { if ($extension=="*"){ #look for everything, #return list of subdirectories and files while (($file = readdir($dh)) !== false) { if (is_dir($path."/".$file)) { if ($file != "." AND $file != ".."){ array_push($directories,$file); } }else{ array_push($fileNames,$file); } } #while closedir($dh); return array($directories,$fileNames); }else{ #return list of files with specified extension while (($file = readdir($dh)) !== false) { if (strpos($file,$extension)>0){ array_push($fileNames,$file); } } #while closedir($dh); return $fileNames; } } } } ?>
Index of Library
Der gesamte Sourcecode darf gemäß GNU General Public License weiterverbreitet werden.