note 38320 deleted from function.copy by tomsommer

From: Date: Wed, 21 Jul 2004 16:07:08 +0000
Subject: note 38320 deleted from function.copy by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-73820@lists.php.net to get a copy of this message
Note Submitter: alex.chacon@terra.com ---- A little better version for the example of torrmal at yahoo dot com published at 04-Jul-2003 11:05 function cp($wf, $wto) { mkdir($wto,0777); $arr=ls_a($wf); if (strcmp ($wf, $wto) == 0) { foreach ($arr as $fn) { if($fn) { $fl="$wf/$fn"; $flto="$wto/$fn"; if(is_dir($fl)) cp($fl,$flto); else copy($fl,$flto); } } } } function ls_a($wh) { if ($handle = opendir($wh)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." ) { if(!isset($files)) $files="$file"; else $files="$file\n$files"; } } closedir($handle); } $arr=explode("\n",$files); return $arr; }

« previous php.notes (#73820) next »