Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Archive::Zip use?

Reply
Thread Tools

Archive::Zip use?

 
 
Geoff Cox
Guest
Posts: n/a
 
      10-11-2003
Hello,

With excellent help from this group I have been able to use the
following code to change a zip file to a doc file with the same name
as the zip file ...

would now like to do the reverse of this in a slightly different way
... I have say 20 doc files in a folder which I would like to zip and
name as doc1.zip, doc2.zip etc ... I am guessing that the code will
not be too different from that below but would appreciate some help on
which Archive::Zip method would be appropriate here...

Thanks

Geoff


use warnings;
use strict;

use File::Find;
use Archive::Zip;

my $dir = 'c:/atemp9';

find( sub {
( my $name = $_ ) =~ s/\.zip$/.doc/i or return;
my $zip = Archive::Zip->new( $_ );
$zip->extractMember( ($zip->memberNames)[ 0 ], $name );
unlink $_ or warn "Cannot delete $_: $!";
}, $dir );
 
Reply With Quote
 
 
 
 
James Willmore
Guest
Posts: n/a
 
      10-13-2003
On Sat, 11 Oct 2003 20:28:12 GMT
Geoff Cox <(E-Mail Removed)> wrote:

> With excellent help from this group I have been able to use the
> following code to change a zip file to a doc file with the same name
> as the zip file ...
>
> would now like to do the reverse of this in a slightly different way
> .. I have say 20 doc files in a folder which I would like to zip and
> name as doc1.zip, doc2.zip etc ... I am guessing that the code will
> not be too different from that below but would appreciate some help
> on which Archive::Zip method would be appropriate here...

<snip>

Have you consulted the documentation?
The command is -
perldoc Archive::Zip

-or-

http://search.cpan.org/~nedkonz/Arch...ve/Zip/FAQ.pod

HTH

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
Putt's Law: Technology is dominated by two types of people:
Those who understand what they do not manage. Those who manage
what they do not understand.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments