note 49215 deleted from function.copy by aidan
| From: | aidan@php.net | Date: | Wed, 15 Apr 2009 12:33:23 +0000 |
| Subject: | note 49215 deleted from function.copy by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153300@lists.php.net to get a copy of this message | ||
Note Submitter:
----
Heres a quick function I wrote to backup whole websites.
I haven't actually tested it out yet. I will later on =P
<?
function backup($extension) {
$counter = 0;
foreach(glob(* . $extension) as $file) {
if ($extension{0} != .) {
$extension = . . $extension;
}
$file2 = ./backup/ . $file;
$counter++;
copy($file, $file2);
}
if ($counter == 0) {
return false;
} else {
return true;
}
}
/* Test -- Copy all images */
$extension_array = array(.jpg, .gif, .png, .bmp);
foreach($extension_array as $key => $value) {
backup($extension);
}
?>