This function is used to copy a folder and all its contents and subfolders, its params are as follows:
1) The source folder path
2) The destination path (should not exist)
function recurseCopy($src, $dst)
{
$dir = opendir($src);
mkdir($dst);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
if ( is_dir($src . '/' . $file) ) {
$this->recurseCopy($src . '/' . $file, $dst . '/' . $file);
} else {
copy($src . '/' . $file,$dst . '/' . $file);
}
}
}
closedir($dir);
}