Last active
June 15, 2017 10:25
-
-
Save dewwwald/46b288120274ea9af956218f350527a9 to your computer and use it in GitHub Desktop.
Recursive copy for php. @credit http://stackoverflow.com/questions/2050859/copy-entire-contents-of-a-directory-to-another-using-php
This file contains 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
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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
doesn't that @mkdir make it a little hard to catch permission related errors?