note 57783 deleted from function.copy by mazzanet
| From: | mazzanet@php.net | Date: | Fri, 14 Oct 2005 05:47:39 +0000 |
| Subject: | note 57783 deleted from function.copy by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96997@lists.php.net to get a copy of this message | ||
Note Submitter:
----
Here Some code to COPY FOLDER and IT CONTENTS..
(from http://aidan.dotgeek.org/)
function copyr($source, $dest)
{
// Simple copy for a file
if (is_file($source)) {
return copy($source, $dest);
}
// Make destination directory
if (!is_dir($dest)) {
mkdir($dest);
}
// Loop through the folder
$dir = dir($source);
while (false !== $entry = $dir->read()) {
// Skip pointers
if ($entry == '.' || $entry == '..') {
continue;
}
// Deep copy directories
if ($dest !== "$source/$entry") {
copyr("$source/$entry", "$dest/$entry");
}
}
// Clean up
$dir->close();
return true;
}