note 57783 added to function.copy
| From: | php-general at lists dot php dot net | Date: | Fri, 14 Oct 2005 01:21:13 +0000 |
| Subject: | note 57783 added to function.copy | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-96989@lists.php.net to get a copy of this message | ||
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;
}
----
Manual Page -- http://www.php.net/manual/en/function.copy.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57783
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57783&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57783&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57783&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57783&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57783&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57783&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57783&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57783&report=yes
Search -- http://master.php.net/manage/user-notes.php