Posted By

cochambre on 06/30/06


Tagged

folder tree files copy duplicate


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

postNuKe
nicolaspar


Copiar un arbol de carpetas y archivos sin limite de niveles


 / Published in: PHP
 

  1. function copiarArbol($source, $dest){
  2. $folder = opendir($source);
  3. while($file = readdir($folder)){
  4. if ($file == '.' || $file == '..') continue;
  5. if(is_dir($source.'/'.$file)){
  6. if( !is_dir($dest.'/'.$file)) mkdir($dest.'/'.$file, 0666);
  7. copiarArbol($source.'/'.$file , $dest.'/'.$file);
  8. }else{
  9. if(strrchr($file,'.') != '.db'){
  10. copy($source.'/'.$file , $dest.'/'.$file );
  11. chmod($dest.'/'.$file , 0666);
  12. }
  13. }
  14. }
  15. closedir($folder);
  16. return 1;
  17. }

Report this snippet  

You need to login to post a comment.