So I wanna zip a folder using RecursiveDirectoryIterator, how fast can it zip up a very complicated directory, with all the files combined together not more than 600 MB of size?
This is the code am using:
$mainFolder=basename($routeFolder);
if(!file_exists('../zips'))
mkdir('../zips', 0744);
$zip = new ZipArchive;
$firstres=$zip->open($zipName, ZipArchive::OVERWRITE);
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($routeFolder),
RecursiveIteratorIterator::SELF_FIRST
);
foreach ($files as $name => $file) {
if(is_file($file) && file_exists($file)){
$new_filename = substr($file, strpos($file, $mainFolder));
$zip->addFile($file,$new_filename);
}
}
$zip->close();
So, approximately, how long is it gonna take to zip up a very complex directory? Is it gonna face any memory issue? Anyway, am using ajax, so it wont lead to browser crashing or browser page becoming unresponsive...but still how long is it gonna take?