note 49216 deleted from function.copy by nlopess

From: Date: Thu, 20 Jan 2005 13:18:28 +0000
Subject: note 49216 deleted from function.copy by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-83678@lists.php.net to get a copy of this message
Note Submitter: scorpion nine nine zero at gmail dot com ---- Here is a quick function I made to backup whole files. Go. <?php function backup($extension) { $counter = 0; foreach(glob(“*” . “$extension”) as $file) { if ($extension{1} != “.”) { $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); } ?>

« previous php.notes (#83678) next »