note 44500 deleted from function.copy by aidan

From: Date: Mon, 30 Aug 2004 07:01:16 +0000
Subject: note 44500 deleted from function.copy by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75636@lists.php.net to get a copy of this message
Note Submitter: walaces at uol dot com dot br ---- This function will copy all entries in source diretory to destin directory recursively, including other directories. <?php function copy_dir($_s_dir,$_d_dir) { if(!is_dir($_s_dir)) { return FALSE; } $_od = getcwd(); // Devemos guardar o diretório atual... chdir($_s_dir); $_d = @opendir("./"); $_ret = TRUE; while (($_l=readdir($_d))!==FALSE) { if(substr($_l,0,1)=="." AND strlen($_l)<=2) { continue; } if(is_dir($_l)) { mkdir("$_d_dir/$_l"); if(!copy_dir("$_s_dir/$_l","$_d_dir/$_l")) { $_ret = FALSE; } } else { if(!copy($_l,"$_d_dir/$_l")) { $_ret = FALSE; } } } closedir($_d); chdir($_od); return $_ret; } ?>

« previous php.notes (#75636) next »