폴더 전체를 복사해 주는 소스입니다.

 <?php
 
function fileCopy($odir,$ndir
) {
      if(
filetype($odir) === 'dir'
) {
           
clearstatcache
();

           if(
$fp = @opendir($odir
)) {
                  while(
false !== ($ftmp readdir($fp
))){
                        if((
$ftmp !== ".") && ($ftmp !== "..") && ($ftmp !== ""
)) {
                              if(
filetype($odir.'/'.$ftmp) === 'dir'
) {
                                   
clearstatcache
();
      
                                   @
mkdir($ndir.'/'.$ftmp
);
                                   echo (
$ndir.'/'.$ftmp."<br />\n"
);
                                   
set_time_limit(0
);
                                   
fileCopy($odir.'/'.$ftmp,$ndir.'/'.$ftmp
);
                              } else {
                                   
copy($odir.'/'.$ftmp,$ndir.'/'.$ftmp
);
                              }
                        }
                  }
           }
           if(
is_resource($fp
)){
                 
closedir($fp
);
           }
      } else {
            echo 
$ndir."<br />\n"
;     
            
copy($odir,$ndir
);
      }
 } 
// end func

 // 복사하고자 하는 폴더를 지정하면 복사본 폴더에 복사가 됩니다.
 
fileCopy('원본 폴더','복사본 폴더'
);
 
?>