Hi,
I received the following code from this URL:
http://aidan.dotgeek.org/lib/?file=function.copyr.php
Here is the code:
<?php
/**
Copy a file, or recursively copy a folder and its contents
@author Aidan Lister <aidan@php.net>
@version 1.0.1
@ string $source Source path
@ string $dest Destination path
@return bool Returns TRUE on success, FALSE on failure
/
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;
}
?>
The code is working perfectly on one server, while it fails on another. I cannot figure out what the problem is and why it is failing on the other server.
I am not getting any error messages however. It appears to work great but when going to the new files, most are completely blank. Is there something on the phpinfo page that I should be looking for?
Any help at all would be greatly appreciated.
Thanks,
Annette