Take the 2-minute tour ×  I am trying to recursively search
through a directory for all sub-directories within any
directories of sub-directories. Basically all folders starting
at the root directory, and I need to copy a file to all folders
found as well as in the main root folder. How can I do this?
Here's what I have so far, but it needs to be recursive
completely so that it gets all folders within that root, and
folders within subs, and folders within that, neverending
search, until there are no more folders left...
@copy($extendVars['dir'] . '/index.php', $real_extendpath .
'/index.php');  $dh = @opendir($real_extendpath);     if ($obj
== '.' || $obj == '..')      if (is_dir($real_extendpath . '/' .
$obj))         @copy($extendVars['dir'] . '/index.php',
$real_extendpath . '/' . $obj . '/index.php');  share|improve
this question You need to make a function out of this to call it
recursive. –  str Oct 29 '11 at 11:49 ok, but how? I'm not
seeing a way to do that. Is there a better way to do this other
th