Dr. Arne Jachens

Set up the Raspberry Pi

no warranty for any of the provided information

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;
      }
    }
  }
}
?>

python

1HvcControl.py
2HvcHCSR04ultrasonic.py
3HvcMain.py
4HvcMotorDriver.py
5HvcOneWire.py
6HvcOperationMode.py
7HvcRaw2phys.py
8HvcReadSPI.py
9HvcSendI2C.py
10HvcSetGPIO.py
11HvcTables.py
12HvcWeather.py
13makeDoc.py

php

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

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