filecopy
// 현재 이 파일의 절대 경로
$THIS_PATH = dirname( realpath( __FILE__ ) );
$src = 'C:\\APM_Setup\\htdoc'; //복사 대상 폴더
$filepath = 'C:\\APM_Setup\\h';
$dst = 'D:\\htmlfile'; //복사가 될 폴더
if( !is_dir( $dst ) ) mkdir( $dst, 0777 );
if( copy_dir( $src, $dst ) ){
if( copy_dir( $filepath, $dst.'\\file' ) ){
echo "OK";
}
}
function del( $path ) {
$d = @opendir( $path );
while( $entry = @readdir( $d ) ) {
if( $entry != "." && $entry != ".." ) {
if( is_dir( $path."/".$entry ) ) del( $path."/".$entry );
else @unlink( $path."/".$entry );
}
}
@closedir($d);
@rmdir($path);
}
function copy_dir( $path, $dst ) {
if( !is_dir( $dst ) ) mkdir( $dst, 0777 );
$d = opendir( $path );
while(false !== ($entry = readdir( $d ) )) {
if( $entry != "." && $entry != ".." ) {
if( is_dir( $path."/".$entry ) ){ //folder process
if(!is_dir( $dst."/".$entry )){ //no folder
copy_dir( $path."/".$entry, $dst."/".$entry );
}
}else{
copy( $path."/".$entry, $dst."/".$entry );
chmod( $dst."/".$entry, 0666 );
}
}
}
closedir($d);
return true;
}