Backup files - respaldar directorio zip web in php function

Backup files - respaldar directorio zip web in php function

//instance
$zip = new ZipArchive();




//try
if($zip->open("filezipname.zip",ZIPARCHIVE::CREATE)!==TRUE){
 DIE("NO SE PUEDE CREAR");
}

//pass directory to iterator
$iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator(".") );





//recorrer array iterator
foreach($iterartor as $key => $value){
$zip->addFile( realpath($key),"tools/0.57/".$key )or die("no se pudo agregar".$key);
}

$zip->close();

echo "Archive created successfully.";   

?>

Backup files - respaldar directorio zip web in php function

0 pensamientos:

Post a Comment

feedback!