This is follow-up question after on my question.
Folder
subfolders
imagefolder
important.txt
index.txt
I have a subfolder, How to zip the Folder
, then delete all files including all the folders within the Folder
exempt the important.txt
?
From the previous post. I've got this:
$zipFile = "./testZip.zip";
$zipArchive = new ZipArchive();
if (!$zipArchive->open($zipFile, ZIPARCHIVE::OVERWRITE))
die("Failed to create archive\n");
$zipArchive->addGlob("./*.txt");
if (!$zipArchive->status == ZIPARCHIVE::ER_OK)
echo "Failed to write files to zip\n";
$zipArchive->close();
But it gave me this output:
testZip.zip
has been created but including only file: important.txt
then the subfolders is not deleted.