<?xml version="1.0" encoding="windows-1252"?>
<node id="442792" title="archive-zip problem" created="2005-03-28 08:18:20" updated="2005-06-28 23:08:20">
<type id="115">
perlquestion</type>
<author id="442498">
dorianwinterfeld</author>
<data>
<field name="doctext">
Here's the problem.  I have a list of html files on a Windows box that I want to zip using Archive-Zip. No matter what I do I get an empty zip file.  Here's the code, see below. $server_root is the doc root of IIS, d:/online.I use CGI because this must be triggered thru a web interface. What am I doing wrong? 
&lt;code&gt;
use CGI qw/:standard/;
use CGI::Carp (fatalsToBrowser);
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
use lib '..';
require 'globals.plx';
require './config.plx';

print header;
open FH,$vsc_log;
my @files = &lt;FH&gt;;
close FH;

print qq(change dir to $server_root),br;
chdir "$server_root" or "Can't cd to $server_root: $!"; 

my $zip = Archive::Zip-&gt;new();
foreach my $file (@files){
	$file =~ s@d:/online/@@;
	$file =~ s@/@\\@g;
	print "add $file",br;
	$zip-&gt;addFile("$file");
}

print qq(write $vsc_zip),br;
die 'write error' unless $zip-&gt;writeToFileNamed( $vsc_zip ) == AZ_OK;
&lt;/code&gt;
thanks for your help - Dorian</field>
</data>
</node>
