Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $sOutput = GetFilesInDirRec("./"); //Das Aktuelle Verzeichnis durchsuchen
- $aFiles = explode("|",$sOutput); // Die Dateien werden als String ausgegeben und mit $sTrennzeichen seperiert... explode wandelt die ganze geschichte in eine array um
- var_dump($aFiles); //ausgeben (fΓΌr FF user ist es besser wenn man sich statt der html interpreterausgabe, den quelltext anguckt.. da ist es formatiert)
- function GetFilesInDirRec($sPath,$Rec=0) {
- //by Sprenger120
- $sTrennzeichen = "|";
- static $sOutput,$sMainPath;
- if ($Rec == 0) {
- $sMainPath = $sPath;
- $sOutput = "";
- }
- $hDir = opendir($sPath);
- while (false !== ($file = readdir($hDir))) {
- if ($file == ".." || $file == ".") { continue; }
- if ($sPath == $sMainPath) {
- $sOutput .= $sTrennzeichen.$sPath.$file;
- if (is_dir($sPath.$file)) { $sOutput = GetFilesInDirRec($sPath.$file,1); }
- } else {
- $sOutput .= $sTrennzeichen.$sPath."/".$file;
- if (is_dir($sPath."/".$file)) { $sOutput = GetFilesInDirRec($sPath."/".$file,1); }
- }
- }
- closedir($hDir);
- return $sOutput;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement