Created
October 26, 2016 20:27
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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