Skip to content

Instantly share code, notes, and snippets.

@TinyPoro
Created December 24, 2018 10:17
Show Gist options
  • Save TinyPoro/bc4c458e15f7053a68e3282fe115fa2f to your computer and use it in GitHub Desktop.
Save TinyPoro/bc4c458e15f7053a68e3282fe115fa2f to your computer and use it in GitHub Desktop.
public function recurse_copy($src,$dst) {
$dir = opendir($src);
@mkdir($dst);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
if ( is_dir($src . '/' . $file) ) {
$this->recurse_copy($src . '/' . $file,$dst . '/' . $file);
}
else {
copy($src . '/' . $file,$dst . '/' . $file);
}
}
}
closedir($dir);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment