//copy dir
function full_copy($source, $target, $exclude = array()) {
//print "Copying " . $source ."\n";
if (is_dir ( $source )) {
if( !is_dir($target) )
@mkdir ( $target, 0755, true);
$d = @dir ( $source );
if( $d )
{
while ( FALSE !== ($entry = $d->read ()) ) {
if ($entry == '.' || $entry == '..' || $entry == '.svn') {
continue;
}
$Entry = $source . '/' . $entry;
if (in_array($Entry,$exclude)) {
continue;
}
if( substr($target, -1, 1)=="/" )
$targetPath = $target . $entry;
else
$targetPath = $target . "/" . $entry;
if (is_dir ( $Entry )) {
$this->full_copy ( $Entry, $targetPath, $exclude );
continue;
}
$cRst = copy ( $Entry, $targetPath );
}
$d->close ();
}
}
else {
copy ( $source, $target );
}
}
COPY一個目錄底下所有文件的函數
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.