I have a file downloaded by a cron that is in zip64 format.
How can I unzip it using php or via a php cmd()?
I have a file downloaded by a cron that is in zip64 format.
How can I unzip it using php or via a php cmd()?
A couple options that I know of.
If your PHP runs on Windows you can use the COM interface to DotNetZip.
$zipInput = "c:\\temp\\zip-downloaded-by-cron.zip";
$zip = new COM("Ionic.Zip.ZipFile");
$zip->Initialize($zipInput);
$dirForExtract= "c:\\temp\\extract";
# optional password
$zip->Password = "AES-Encryption-Is-Secure";
$zip->ExtractAll($dirForExtract);
$zip->Dispose();
For DotNetZip, ZIP64 is automatically used when necessary, when reading in a zip file.
Alternatively, you can invoke the command-line tool provided with DotNetZip.
This has the advantage of working on Linux+Mono, in addition to Windows+.NET.
The tool is unzip.exe, and you can just invoke (cmd) unzip.exe downloaded-zip.zip
. It will automatically handle the zip64 stuff. There are options on unzip.exe to specify where to extract, which files to extract, and so on.
Apparently Perl's IO::Compress::Zip
module supports Zip64. If you're comfortable enough to install it you could call a small Perl script via shell_exec()
.
surprisingly unix's unzip just worked!
exec(unzip -n -q zip-downloaded-by-cron.zip -d photos);