帝国软件
  设为首页 加入收藏 关于我们
 
解密帝国网站管理系统
栏 目:
 
您的位置:首页 > 技术文档 > PHP编程
无限级目录与目录之间的复制代码(wm_chief原创)
作者:匿名 发布时间:2003-12-31 来源:PHP帝国
无限级目录复制,站长原创,虽只写了短短几分钟,但还是挺有用的
<?
//本程序由wm_chief原创,如要转载,请注明作者与来源(http://www.phome.net)
$o_path="admin";//源目录
$n_path="n_admin";//新目录
class copy_path
{
function wm_chief_copypath($o_path,$n_path)
{$hand=opendir($o_path);
if(!file_exists($n_path))//目标目录不存在则建立
{$this->wm_chief_createpath($n_path);}
$i=0;
while($file=readdir($hand))
{$i++;
if($i==1||$i==2)
{continue;}
if(!(strchr($file,".")))
{
$o_s_path=$o_path."/".$file;
$n_s_path=$n_path."/".$file;
$this->wm_chief_copypath($o_s_path,$n_s_path);
}
else
{
$o_file=$o_path."/".$file;
$n_file=$n_path."/".$file;
$this->wm_chief_copyfile($o_file,$n_file);
}
}
closedir($hand);
return true;
}
function wm_chief_copyfile($o_file,$n_file)
{
copy($o_file,$n_file);
}
function wm_chief_createpath($n_path)
{
mkdir($n_path,0777);
}
}
$wm_chief=new copy_path();
$wm_chief_ok=$wm_chief->wm_chief_copypath($o_path,$n_path);
if($wm_chief_ok)
{
echo"复制完毕";
}
//本程序由wm_chief原创,如要转载,请注明作者与来源(http://www.phome.net)
?>
  
评论】【加入收藏夹】【 】【打印】【关闭
※ 相关链接
 ·使用无限生命期Session的方法  (2005-03-11)
 ·php 进阶:实现无限分类(4)  (2005-03-11)
 ·php 进阶:实现无限分类(3)  (2005-03-11)
 ·php 进阶:实现无限分类(2)  (2005-03-11)
 ·php 进阶:实现无限分类(1)  (2005-03-11)
 ·删除无限级目录与文件代码共享  (2004-05-24)

   栏目导行
  PHP编程
  ASP编程
  ASP.NET编程
  JAVA编程
   站点最新
·致合作伙伴的欢迎信
·媒体报道
·帝国软件合作伙伴计划协议
·DiscuzX2.5会员整合通行证发布
·帝国CMS 7.0版本功能建议收集
·帝国网站管理系统2012年授权购买说
·PHPWind8.7会员整合通行证发布
·[官方插件]帝国CMS-访问统计插件
·[官方插件]帝国CMS-sitemap插件
·[官方插件]帝国CMS内容页评论AJAX分
   类别最新
·Windows下集成安装Apache,PHP,MYSQ
·Mysql注入:SQL Injection with MyS
·PHP 的来龙去脉
·PHP 的功能概述
·PHP与其它CGI的比较
·PHP 的编译配置详细选项
·php.ini 配置详细选项
·如何写作PHP程序
·Hello,World
·嵌入方法
 
关于帝国 | 广告服务 | 联系我们 | 程序开发 | 网站地图 | 留言板 帝国网站管理系统