我正在使用我写入的功能来复制目录和文件。它只是复制目录和文件一次。仅当文件不存在时,我如何才能将源文件夹中的文件复制到目标文件夹?递归复制文件和文件夹和子文件夹
这里是函数。基本上我想将分析器上载文件夹中的文件夹labref及其内容复制到第二个文件夹store_for_issue中。如果文件在同一天上传到源文件夹,应将文件复制到目标文件夹'store_for_issue'。创建文件夹,如果不存在或更新内容
public function full_copy() {
$labref= $this->uri->segment(3);
$source='analyst_uploads/'.date('Y').'/'.date('M').'/'.$labref;
$newfolder='store_for_issue';
if(is_dir($newfolder)){
mkdir($newfolder.'/'.$labref,0777,TRUE);
}
$target=$newfolder.'/'.$labref.'/';
copy($source, $target);
}