- $dir = opendir($source);
- @mkdir($destination);
- while (FALSE !== ($file = readdir($dir))) {
- if (($file != '.') && ($file != '..')) {
- if (is_dir($source . DIRECTORY_SEPARATOR . $file)) {
- CRM_Utils_File::copyDir($source . DIRECTORY_SEPARATOR . $file, $destination . DIRECTORY_SEPARATOR . $file);
- }
- else {
- copy($source . DIRECTORY_SEPARATOR . $file, $destination . DIRECTORY_SEPARATOR . $file);
+ if ($dir = opendir($source)) {
+ @mkdir($destination);
+ while (FALSE !== ($file = readdir($dir))) {
+ if (($file != '.') && ($file != '..')) {
+ if (is_dir($source . DIRECTORY_SEPARATOR . $file)) {
+ CRM_Utils_File::copyDir($source . DIRECTORY_SEPARATOR . $file, $destination . DIRECTORY_SEPARATOR . $file);
+ }
+ else {
+ copy($source . DIRECTORY_SEPARATOR . $file, $destination . DIRECTORY_SEPARATOR . $file);
+ }