note 60052 deleted from function.copy by aidan

From: Date: Sat, 24 Dec 2005 05:03:59 +0000
Subject: note 60052 deleted from function.copy by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-100649@lists.php.net to get a copy of this message
Note Submitter: Sean at seanj dot jcink dot com Reason: useless ---- Heres a short function I made to copy whole directories: [code]function copydir($a,$b){ if (!@mkdir($b)) return false; $o=@opendir($a); if (!$o) return false; while(false!==($f=readdir($o))) { if ($f==".."||$f==".") continue; if (is_dir($a."/".$f)) {if (!copydir($a."/".$f,$b."/".$f)) return false;} else {if (!@copy($a."/".$f,$b."/".$f)) return false;} } closedir($o); return true; }[/code] very short... and returns false on failure; true on success. Simple enough right? You may have to alter it to fit your CHMOD needs though.

« previous php.notes (#100649) next »