[转]PHP复制整个文件夹的FUNCTION
2011-03-02 17:30
197 查看
/** * 复制文件夹 * @param str $source 源文件夹 * @param str $destination 目标文件夹 * @param bool $child true则带有子目录的复制 */ function xCopy($source, $destination, $child = true) { if (! is_dir ( $source )) { echo ("Error:the $source is not a direction!"); return 0; } if (! is_dir ( $destination )) { mkdir ( $destination, 0777 ); } $handle = dir ( $source ); while ( $entry = $handle->read () ) { if (($entry != ".") && ($entry != "..")) { if (is_dir ( $source . "/" . $entry )) { if ($child) xCopy ( $source . "/" . $entry, $destination . "/" . $entry, $child ); } else { copy ( $source . "/" . $entry, $destination . "/" . $entry ); } } } return true; }
相关文章推荐
- PHP递归复制整个文件夹
- [PHP][Function]实现将一个文件夹下的所有文件及文件夹复制到另一个文件夹里(保持原有结构
- PHP实现递归复制整个文件夹的类实例
- PHP实现递归复制整个文件夹的类实例
- [PHP][Function]实现将一个文件夹下的所有文件及文件夹复制到另一个文件夹里(保持原有结构)[已验证][原创]
- 文件夹操作:复制和删除整个文件夹
- PHP创建/删除/复制文件夹、文件
- PHP打包下载整个文件夹或多文件
- PHP操作文件类(文件和文件夹创建,复制,移动和删除)
- PHP 文件夹操作「复制、删除、查看大小」递归实现
- php复制文件夹以及文件夹里的所有文件
- php--------文件夹文件拷贝和复制
- java---复制整个文件夹所有内容
- php(创建、删除、移动、复制)文件及文件夹操作的实现方法
- PHP打包下载整个文件夹或多文件
- php : 文件及文件夹操作(创建、删除、移动、复制)
- PHP基于迭代实现文件夹复制、删除、查看大小等操作的方法
- PHP 文件夹操作「复制、删除、查看大小」迭代实现
- PHP目录,文件操作详谈(文件、文件夹的生成、复制、删除、读取)
- java实现整个文件夹的复制(同一路径下会复制出-副本)