update
This commit is contained in:
34
pack/zip.php
Normal file
34
pack/zip.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
|
||||
$images_dir = '../aem';
|
||||
//this folder must be writeable by the server
|
||||
$backup = '/';
|
||||
$zip_file = $backup.'/backup.zip';
|
||||
echo $images_dir;
|
||||
if ($handle = opendir($images_dir))
|
||||
{
|
||||
$zip = new ZipArchive();
|
||||
|
||||
if ($zip->open($zip_file, ZIPARCHIVE::CREATE)!==TRUE)
|
||||
{
|
||||
exit("cannot open <$zip_file>\n");
|
||||
}
|
||||
|
||||
while (false !== ($file = readdir($handle)))
|
||||
{
|
||||
$zip->addFile($images_dir.'/'.$file);
|
||||
echo "$file\n";
|
||||
}
|
||||
closedir($handle);
|
||||
echo "numfiles: " . $zip->numFiles . "\n";
|
||||
echo "status:" . $zip->status . "\n";
|
||||
$zip->close();
|
||||
echo 'Zip File:'.$zip_file . "\n";
|
||||
}
|
||||
Reference in New Issue
Block a user