note 100680 deleted from function.copy by danbrown
| From: | danbrown@php.net | Date: | Sat, 30 Oct 2010 14:47:40 +0000 |
| Subject: | note 100680 deleted from function.copy by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173607@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
An updated remote file/folder recursively copy function
function recurse_copy($src,$dst) {
$dir = opendir($src);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
if ( is_dir($src . '/' . $file) ) {
if(!file_exists($dst . '/' . $file))
{
mkdir($dst . '/' . $file);
chmod($dst.'/'.$file,0777);
}
recurse_copy($src . '/' . $file,$dst . '/' . $file);
}
else {
copy($src . '/' . $file,$dst . '/' . $file);
}
}
}
closedir($dir);
}