Dr. Arne JachensDr. Arne Jachens

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

1globals.php
2readData.php
3XML_readFile.php
4fraktal.php
5fileGrep.php
6XML_extractTag.php
7writeNamedData.php
8readXmlFile.php
9readNamedData.php
10XML_findAllElements.php
11readFromStdIn.php
12plotResult.php
13dtaus.php
14pdf.php
15fitData.php
16XML_extractElement.php
17readFilenames.php
18writeData.php
19genDTAUS.php
20closeFigures.php
21XML_extractAttribute.php
22enumerateFiles.php
23db.php
24polynominalFit.php
25LaTeXbrief.php
26hex2dec.php

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