drodinthe559 has asked for the wisdom of the Perl Monks concerning the following question:
Your help would be greatly appreciated. Thanks, Dave#!/usr/bin/perl -w use strict; use warnings; use File::Basename; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); my $procdate = sprintf "%02d%02d%02d%02d%02d%02d", (localtime)[4]+1, ( +localtime)[3], substr((localtime)[5]+1900,2,2),(localtime)[2], (local +time)[1], (localtime)[0]; #Pull in all the xml files for each report. my @dipfile = glob('C:/ReportExtract/Director/*.xml'); foreach my $xml_file (@dipfile) { ##### Zip each file into a zip file for archiving ##### my $targetdir = File::Spec->catdir('C:/ReportExtract/Director/'); my $targetzip = File::Spec->catdir($targetdir, basename($procd +ate) . ".zip"); #Need basename. my $zip = Archive::Zip->new(); my $zipdir = $zip->addDirectory($targetdir); my $temp = File::Basename::fileparse($xml_file); $zipdir = $zip->addFile('test.xml'); #$zip->writeToFileNamed($targetzip); unless ( $zip->writeToFileNamed($targetzip) eq "AZ_OK" ) { die 'read error';} };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Archive::Zip Simple Issue
by Fletch (Bishop) on May 29, 2009 at 18:52 UTC | |
|
Re: Archive::Zip Simple Issue
by scorpio17 (Canon) on May 29, 2009 at 19:35 UTC | |
by drodinthe559 (Monk) on May 29, 2009 at 21:26 UTC | |
by scorpio17 (Canon) on May 30, 2009 at 19:13 UTC |