PHP怎么复制文件夹下的某些目录

WBOY
Release: 2016-06-13 12:41:07
Original
965 people have browsed it

PHP如何复制文件夹下的某些目录

function copy_module_file($path,$newp){<br />
	if(!is_dir($newp)){<br />
		mkdir($newp);<br />
	}<br />
	if (file_exists($path)){<br />
		if(is_file($path)){<br />
			copy($path,$newp);<br />
		} else{<br />
			$handle = opendir($path);<br />
			while (($file = readdir($handle))!='') {<br />
				if (($file!=".") && ($file!="..") && ($file!="")){<br />
					if (is_dir("$path/$file")){<br />
						copy_module_file("$path/$file","$newp/$file");<br />
					} else{<br />
						copy("$path/$file","$newp/$file");<br />
					}<br />
				}<br />
			}<br />
			closedir($handle);<br />
		}<br />
	}<br />
}
Copy after login




这段php代码是我程序中的,一个复制些个文件夹下的目录到另一个文件夹下,里面有好多目录,比如该文件夹里面有1-100个目录名字分别是1-100,我只想复制: 1,2,3,4 这几目录其它的不复制,这段php需要怎么改一下,我是新手,希望得到高手指点!
PHP

Related labels:
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