<?php
function read_all ($dir,$newDir)
{
if(!is_dir($dir)) return false;
$handle = opendir($dir);
if($handle){
while(($file = readdir($handle)) !== false)
{
// 过滤 父级文件夹
if($file == '.' || $file == '..') continue;
$temp = $dir.DIRECTORY_SEPARATOR.$file;
if(is_dir($temp) )
{
read_all($temp);
}
else
{
copy($temp,$newDir.DIRECTORY_SEPARATOR.$file); //拷贝到新目录
}
}
}
}
read_all('E:\res\src','E:\res\new');
?>