Home > Backend Development > PHP Tutorial > php 复制目录,但目录下的子目录及文件没有复制?

php 复制目录,但目录下的子目录及文件没有复制?

WBOY
Release: 2016-06-23 14:17:44
Original
868 people have browsed it

copy_module_file("123","345",array('1','2','3','4'));	function copy_module_file($path,$newp,$ex){	if(!is_dir($newp)){		mkdir($newp);	}	if (file_exists($path)){		if(is_file($path)){			copy($path,$newp);		} else{			$handle = opendir($path);			while (($file = readdir($handle))!='') {				if (($file!=".") && ($file!="..") && ($file!="")){					if (is_dir("$path/$file") && in_array($file,$ex)){  //后面一段是复制指定目录						copy_module_file("$path/$file","$newp/$file");					} else{						copy("$path/$file","$newp/$file");					}				}			}			closedir($handle);		}	}}
Copy after login

如果123这个目录下,有1-100个目录,目录下有什么不同的目录,但我想要把123里面的1,2,3,4目录包括目录里的文件复制到345这个目录里,这段php应该怎么再改一下??


回复讨论(解决方案)

http://blog.csdn.net/lijpwsw/article/details/6790461

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template