Adsense
Popular Posts
- MySQL workbench -"Could not decrypt password cache"
- peer review (3)
- PHP, dump varailbes in a format way
- "Unusual traffic from your computer network" from blogger
- Install APXS in Redhat Linux
- JavaScript, remove trailing insignificant zeros after toFixed function
- Update member directory
- Set Windows path command line
- JavaScript: add days to current date
- DataTable table order by numeric, not by text
Thursday, November 14, 2013
PHP, copy directory
The following PHP function copys is used to copy entire directories
* Allows the copying of entire directories.
* @access public
* @param string $source the source directory
* @param string $dest the destination directory
* @return boolean whether the copy was successful or not
function copys($source,$dest)
{
if (!is_dir($source)) {
return false;
}
if (!is_dir($dest)) {
mkdir($dest);
}
$h=@dir($source);
while (@($entry=$h->read()) !== false) {
if (($entry == '.') || ($entry == '..')) {
continue;
}
if (is_dir("$source/$entry") && $dest!=="$source/$entry") {
copys("$source/$entry", "$dest/$entry");
} else {
@copy("$source/$entry", "$dest/$entry");
}
}
$h->close();
return true;
}
Labels:
php
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment