note 25059 deleted from function.copy by alindeman

From: Date: Fri, 09 May 2003 22:17:14 +0000
Subject: note 25059 deleted from function.copy by alindeman
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-47798@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); } } } } }

« previous php.notes (#47798) next »