Skip to content

Instantly share code, notes, and snippets.

@tuckbloor
Created October 26, 2016 20:27
Show Gist options
  • Select an option

  • Save tuckbloor/a21fdbec4f303cf01709d61ab46d9058 to your computer and use it in GitHub Desktop.

Select an option

Save tuckbloor/a21fdbec4f303cf01709d61ab46d9058 to your computer and use it in GitHub Desktop.
copy a directory into the root copies files from a directory called "mobile" into the root
<?php
function recursive_copy($src,$dst) {
$dir = opendir($src);
@mkdir($dst);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
if ( is_dir($src . '/' . $file) ) {
recursive_copy($src . '/' . $file,$dst . '/' . $file);
}
else {
copy($src . '/' . $file,$dst . '/' . $file);
}
}
}
closedir($dir);
}
recursive_copy("mobile", $_SERVER['DOCUMENT_ROOT'] . '/');//edit this
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment