tags:

views:

104

answers:

3

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: 

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.

Cheeso
Linux no mono, is it possible to use DotNetZip unzip.exe?
Traveling_Monk
No, if you are on Linux, you need mono to run DotNetZip.
Cheeso
A: 

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().

deceze
because of the server prob can't install the perl php module. So I can call the script through passthru() or cmd() I need to inflate the zip64 (IO::Uncompress::Unzip ?) I have perl, v5.8.8 built for i686-linux anyone know a simple perl script i could call?
Traveling_Monk
+1  A: 

surprisingly unix's unzip just worked!

exec(unzip -n -q zip-downloaded-by-cron.zip -d photos);
Traveling_Monk