In php, I can create a zip file using:
$zip = new ZipArchive();
$zipname = "somename" . '.zip';
$zip->open($zipname, ZipArchive::CREATE | ZipArchive::OVERWRITE);
and add files to it with
$zip->addFile($pathtodir."filename.bla", "filenameinzip.bla");
or I can add a empty folder to it with:
$zip->addEmptyDir("foldername");
but, is there a way to add a folder which already exists and has sub-content to a zip file directly?
IMPORTANT: the solution in the other thread adds only files in the folder directly to zip, but not the folder itself. I want to keep the structure, meaning the folder should be in the zip file too, not only its sub-content. like:
zipname.zip/foldername/filenameinzip.bla