Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>No, the <a href="http://fr2.php.net/manual/en/function.copy.php" rel="nofollow"><strong><code>copy()</code></strong></a> function is not recursive : it cannot copy folders and their contents.</p> <p><br> But if you take a look at the <strong>users's notes</strong> on that manual page, you'll find some propositions of recursive implementations.</p> <p>For example, <a href="http://fr2.php.net/manual/en/function.copy.php#91010" rel="nofollow">here's a recursive function proposed by <strong>gimmicklessgpt</strong></a> <em>(quoting his post)</em> :</p> <pre><code>&lt;?php function recurse_copy($src,$dst) { $dir = opendir($src); @mkdir($dst); while(false !== ( $file = readdir($dir)) ) { if (( $file != '.' ) &amp;&amp; ( $file != '..' )) { if ( is_dir($src . '/' . $file) ) { recurse_copy($src . '/' . $file,$dst . '/' . $file); } else { copy($src . '/' . $file,$dst . '/' . $file); } } } closedir($dir); } ?&gt; </code></pre> <p><br></p> <hr> <p><strong>Edit after the edit of the question :</strong></p> <p>You are calling your function passing it parameters :</p> <pre><code>recurse_copy($src . '/' . $file,$dst . '/' . $file); </code></pre> <p>But your function is defined as taking no parameter :</p> <pre><code>function recurse_copy(){ $src = dirname(__FILE__).'/themes/'; $dst = dirname( STYLESHEETPATH ).'/'; ... </code></pre> <p>You should correct your function's definition, so it takes parameters -- and not initialize those <code>$src</code> and <code>$dst</code> inside the function, but on its first call.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload