note 49215 added to function.copy

From: Date: Thu, 20 Jan 2005 12:34:44 +0000
Subject: note 49215 added to function.copy
Groups: php.notes 
Request: Send a blank email to php-notes+get-83675@lists.php.net to get a copy of this message
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); } ?> ---- Manual Page -- http://www.php.net/manual/en/function.copy.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49215 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49215&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49215&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49215&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49215&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49215&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+49215&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#83675) next »