I have this function that does .zip
of the current folder to save. But I want it to be saved in the backup
folder.
$data = date("d_m_y");
$exten = "_backup.zip"; // Nome final com extensão
class Zipper extends ZipArchive
{
public function Compact($cwd) {
$open = opendir($cwd);
while($folder = readdir($open))
{
if ($folder != '.' && $folder != '..')
{
if (is_dir($cwd.'/'.$folder))
{
$dir = str_replace('./', '',($cwd.'/'.$folder));
$this->addEmptyDir($dir);
$this->Compact($dir);
}
elseif (is_file($cwd.'/'.$folder))
{
$arq = str_replace('./', '',$cwd.'/'.$folder);
$this->addFile($arq);
}
}
}
}
}
$zip = new Zipper();
if ($zip->open($data.$exten, ZIPARCHIVE::CREATE) === true){
$zip->Compact(".");
}
$zip->close();'