Heizungssteuerung Web-Interface
readFilenames
Script to get content of directory $path.
If $extension is set to some file type, a list of files of this kind is returned.
If $extension = * is set, lists of all subdirectories and all contained files are returned.
<?php /* published under GPL www.gnu.org/licenses/gpl.html */ function readFilenames($path,$extension){ $fileNames=array(); $directories=array(); if (is_dir($path)) { if ($dh = opendir($path)) { if ($extension=="*"){ 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{ while (($file = readdir($dh)) !== false) { if (stripos($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.