note 25059 added to function.copy

From: Date: Mon, 09 Sep 2002 16:24:32 +0000
Subject: note 25059 added to function.copy
Groups: php.notes 
Request: Send a blank email to php-notes+get-36397@lists.php.net to get a copy of this message
Had problems with a lot of these so tweaked them and came up with this.. function rec_copy ($from_path, $to_path) { if(!is_dir($to_path)) { mkdir($to_path, 0777); } if ($handle = opendir($from_path)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if (is_file($from_path."/".$file)) { copy($from_path."/".$file,$to_path."/".$file); } elseif ( is_dir($from_path."/".$file) ) { rec_copy($from_path."/".$file,$to_path."/".$file); } } } } } -- http://www.php.net/manual/en/function.copy.php http://master.php.net/manage/user-notes.php?action=edit+25059 http://master.php.net/manage/user-notes.php?action=delete+25059 http://master.php.net/manage/user-notes.php?action=reject+25059

« previous php.notes (#36397) next »