Skip to content

Instantly share code, notes, and snippets.

@dewwwald
Last active June 15, 2017 10:25
Show Gist options
  • Save dewwwald/46b288120274ea9af956218f350527a9 to your computer and use it in GitHub Desktop.
Save dewwwald/46b288120274ea9af956218f350527a9 to your computer and use it in GitHub Desktop.
function recurse_copy($src,$dst) {
$dir = opendir($src);
@mkdir($dst);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
if ( is_dir($src . '/' . $file) ) {
recurse_copy($src . '/' . $file,$dst . '/' . $file);
}
else {
copy($src . '/' . $file,$dst . '/' . $file);
}
}
}
closedir($dir);
}
@frumbert
Copy link

doesn't that @mkdir make it a little hard to catch permission related errors?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment