我的番茄炒蛋
生活如此精彩,挑战无处不在!

导航

 
  1. /***
  2. * Finished: 2007-05-22
  3. * COPY files or folder
  4. */
  5. // example
  6. wlccopy('../test', '../bac');
  7. /**
  8. * copy files or folder
  9. * notice: $path2 not in $path1
  10. */
  11. function wlccopy($path1,$path2)
  12. {
  13.     if(@is_dir($path1)){
  14.         @mkdir($path2, 0777);
  15.         @chmod($path2, 0777);
  16.         $dir=@opendir($path1);
  17.  
  18.         while($file=@readdir($dir)){ 
  19.             if($file=="." || $file==".."){
  20.                 continue;
  21.             }elseif(@is_file($path1, $file)){
  22.                 @copy("$path1/$file", "$path2/$file");
  23.             }else{
  24.                 wlccopy("$path1/$file", "$path2/$file");
  25.             }
  26.         }
  27.         @closedir($dir);
  28.     } else {
  29.         if(@copy($path1,$path2)){   
  30.             return 1;
  31.         }else {
  32.             return 0;
  33.         }
  34.     }
  35. }
posted on 2008-02-01 14:51  bluesky  阅读(388)  评论(0编辑  收藏  举报