All pastes #383500 Raw Edit

Something

public text v1 · immutable
·published 2007-03-06 12:32 UTC
rendered paste body
<?php
function traverseDirTree($base,$fileFunc,$dirFunc=null,$afterDirFunc=null){
  $subdirectories=opendir($base);
  while (($subdirectory=readdir($subdirectories))!==false){
    $path=$base.$subdirectory;
    if (is_file($path)){
      if ($fileFunc!==null) $fileFunc($path);
    }else{
      if ($dirFunc!==null) $dirFunc($path);
      if (($subdirectory!='.') && ($subdirectory!='..')){
        traverseDirTree($path.'/',$fileFunc,$dirFunc,$afterDirFunc);
      }
      if ($afterDirFunc!==null) $afterDirFunc($path);
    }
  }
}

function outputPath($path){
  if ((basename($path)!='.') && (basename($path)!='..')){
   if(stristr(basename($path), '.') === FALSE) {
    echo "<b>".basename($path)."</b>";
    echo "<br>";
   } else {
    echo "<a target=\"new\" href='".$path."'>".basename($path)."</a>";
    echo "<br>";

   }
  }
}
//echo '<pre>';
traverseDirTree('directorio_donde_minskog_guarda_fotos_de_Lopera','outputpath','outputpath');
//echo '</pre>';

?>