Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

store in a directory/files array

this question is related to
https://www.experts-exchange.com/questions/27998415/all-the-files-in-one-folder-and-all-the-files-that-are-in-that-folder.html

function readDirs($path){
  $dirHandle = opendir($path);
  while($item = readdir($dirHandle)) {
    $newPath = $path."/".$item;
    if(is_dir($newPath) && $item != '.' && $item != '..') {
       echo "Found Folder $newPath<br>";
       readDirs($newPath);
    }
    else{
      echo '&nbsp;&nbsp;Found File or .-dir '.$item.'<br>';
    }
  }
}

$path =  "drupal";
echo "$path<br>";

readDirs($path);

Open in new window




is there a way to put this in an array
so I can differ between
'f'ile
and
'd'ir

and I do a
foreach($array as $key=>$filename){
ASKER CERTIFIED SOLUTION
Avatar of Lukasz Chmielewski
Lukasz Chmielewski
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER