I have found here at stackoveflow some codes on how to ZIP a specific file, but how about a specific folder?
Folder/ index.html picture.jpg important.tx
Try this:
$zip = new ZipArchive; $zip->open('myzip.zip', ZipArchive::CREATE); foreach (glob("target_folder/*") as $file) { $zip->addFile($file); if ($file != 'target_folder/important.txt') unlink($file); } $zip->close();
This will not zip recursively though.