function.php
上传用户:feiyaoda
上传日期:2016-11-21
资源大小:9556k
文件大小:1k
- <?
- function cpDir($from_path, $to_path)
- {
- $result = @mkdir($to_path, 0777);
- if(!$result) trigger_error("erreur lors de la cr閍tion d'un dossier ($to_path)", E_USER_ERROR);
- $this_path = getcwd();
- if (is_dir($from_path))
- {
- $result = $result and chdir($from_path);
- if(!$result) trigger_error("chemin inexistant ($from_path)", E_USER_ERROR);
- $handle=opendir('.');
- $result = $result and ($handle!=null);
- if(!$result) trigger_error("chemin inexistant ou non autorise ($from_path)", E_USER_ERROR);
- while (($file = readdir($handle))!==false) if (($file != ".") && ($file != "..")) if (is_dir($file))
- {
- $result = $result and cpDir($from_path.$file."/", $to_path.$file."/");
- if(!$result) trigger_error("erreur de copie ($from_path.$file vers $to_path.$file)", E_USER_ERROR);
- $result = $result and chdir($from_path);
- if(!$result) trigger_error("chemin inexistant ou non autorise ($from_path)", E_USER_ERROR);
- }
- elseif (is_file($file)) $result = $result and copy($from_path.$file, $to_path.$file);
- closedir($handle);
- }
- return $result;
- }
- ?>