• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 290
  • 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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

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