function.php
Upload User: feiyaoda
Upload Date: 2016-11-21
Package Size: 9556k
Code Size: 1k
Category:

WEB Mail

Development Platform:

PHP

  1. <?
  2. function cpDir($from_path, $to_path) 
  3. {
  4. $result = @mkdir($to_path, 0777);
  5. if(!$result) trigger_error("erreur lors de la cr閍tion d'un dossier ($to_path)", E_USER_ERROR);
  6. $this_path = getcwd();
  7. if (is_dir($from_path)) 
  8. {
  9. $result = $result and chdir($from_path);
  10. if(!$result) trigger_error("chemin inexistant ($from_path)", E_USER_ERROR);
  11. $handle=opendir('.');
  12. $result = $result and ($handle!=null);
  13. if(!$result) trigger_error("chemin inexistant ou non autorise ($from_path)", E_USER_ERROR);
  14. while (($file = readdir($handle))!==false) if (($file != ".") && ($file != "..")) if (is_dir($file)) 
  15. {
  16. $result = $result and cpDir($from_path.$file."/", $to_path.$file."/");
  17. if(!$result) trigger_error("erreur de copie ($from_path.$file vers $to_path.$file)", E_USER_ERROR);
  18. $result = $result and chdir($from_path);
  19. if(!$result) trigger_error("chemin inexistant ou non autorise ($from_path)", E_USER_ERROR);
  20. }
  21. elseif (is_file($file)) $result = $result and copy($from_path.$file, $to_path.$file);
  22. closedir($handle); 
  23. }
  24. return $result;
  25. }
  26. ?>