--- Tom Phoenix <[EMAIL PROTECTED]> wrote:

> On 9/11/06, Derek B. Smith
> <[EMAIL PROTECTED]> wrote:
> 
> > I need to compress a bunch of files, so instead of
> > making a system call to gzip I figured to try out
> > Archive::Zip.
> > After running this code it creates a new file but
> is
> > larger in size.
> 
> That module automatically uses Compress::Zlib to
> compress the data.
> Were any of the files compressed before you started?
> Compression
> algorithms can't shrink every file, and files that
> have compact
> formats can't be shrunk. If you try collecting the
> files with another
> archiving tool, you should see roughly the same
> results, if they're
> already compact: The archive will be roughly the
> same size as the
> uncompressed data, or a little larger.
> 
> Cheers!
> 
> --Tom Phoenix

**********************
Thank you 4 replying!.
The files attributes prior to using gzip were:
-rw-r--r--   1 root       sys        9007879 Sep 11
15:24 derek.log

after compression using gzip are:
-rw-r--r--   1 root       sys         393013 Sep 11
15:24 derek.log.gz

as you can see this file was compressed significantly
as it is a large text based file:
#>file derek.log
derek.log:      ascii text

Is this code syntactically correct to produce a zipped
file ?  I read the POD and there are no clear
examples. Please help...thank you
derek


#!/usr/bin/perl

use strict;
use warnings;
use diagnostics;
use Data::Dumper;
use Readonly;
use Archive::Zip qw ( :ERROR_CODES :CONSTANTS );

my $zip = Archive::Zip->new();

# add all readable files and directories
  $zip->addTree( '/usr/local/admin', 'derek' );
  # and write them into a file
  $zip->writeToFileNamed('xxx.zip');



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to