note 14855 added to function.copy.php

From: Date: Fri, 17 Aug 2001 14:29:41 +0000
Subject: note 14855 added to function.copy.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-16844@lists.php.net to get a copy of this message
Here is a sample function for copy a directory, and ALL subdirectories. ----- function rec_copy ($from_path, $to_path) { mkdir($to_path, 0777); $this_path = getcwd(); if (is_dir($from_path)) { chdir($from_path); $handle=opendir('.'); while (($file = readdir($handle))!==false) { if (($file != ".") && ($file != "..")) { if (is_dir($file)) { rec_copy ($from_path.$file."/", $to_path.$file."/"); chdir($from_path); } if (is_file($file)){ copy($from_path.$file, $to_path.$file); } } } closedir($handle); } } http://www.php.net/manual/en/function.copy.php

« previous php.notes (#16844) next »