Dr. Arne JachensDr. Arne Jachens

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

1EM_editParameter.php
2EM_handleJSON.php
3EM_plot.php
4HV_Admin_Login.php
5HV_colorMap.php
6HV_composeH2Oplot.php
7HV_config.php
8HV_H2Olevel.php
9HV_readOperationState.php
10HV_restart.php
11HV_serviceLog.php
12HV_setParameters.php
13HV_showHouse.php
14HV_showLog.php
15HV_showWeatherForecast.php
16HV_TempCal.php
17index.php
18readFilenames.php
19readNamedData.php

Der gesamte Sourcecode darf gemäß GNU General Public License weiterverbreitet werden.