[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 286
  • Last Modified:

How to create zip files withou using Archive::zip?

Hi techies,

I have an array of filenames, I want to create a zip file without using Archive::zip module.
Can anybody help me with code?
It is very urgent...

Thanks in advance,
Lakshmi
0
lakshmi_n
Asked:
lakshmi_n
1 Solution
 
jmcgOwnerCommented:
If you don't want to use Archive::Zip, does that mean that you also don't want to use Compress::Zlib or the binary Zlib or the binary executable 'zip' program? If we understood better the particular reason you want to do this with one or both hands tied behind your back, we might be able to give you a satisfactory answer.
0
 
TintinCommented:
Assuming you have zip on the system, you can do:

system "zip", "filename.zip", @arrayoffilenames and die "Can not run zip $!\n";
0
 
lakshmi_nAuthor Commented:
Hi,

I dont want to use any non-standard modules that does not come along with Active Perl

Thanks,
Lakshmi
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
lakshmi_nAuthor Commented:
Using Compress:Zlib, how do I compress the files to .zip?
0
 
kanduraCommented:
You don't. Zlib is a different compression algorithm.
I suggest you use Archive::Tar (which comes with ActivePerl), and use the 'compressed' option to make a tar.gz file (which Winzip can open).

Something like this:

use Archive::Tar;

$tar = new Archive::Tar;
$tar->add_files( your files here );
$tar->write( 'yourfile.tar.gz', 1 );
0
 
TintinCommented:
Archive::Zip is a standard module that comes with ActiveState Perl (5.8.x at least)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now