#!c:\perl\bin\perl -w use strict; use IO::Handle; use Cwd; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); my ($tree, $zipname); my $zip = Archive::Zip->new(); { my $today = scalar localtime(); if ( $#ARGV != 1 ) { print "$0:Usage $0 directory_tree zip_file_name\n"; exit; } else { $ARGV[0] =~ s/\"//g; $zip->addTree( "$ARGV[0]", '.' ); $zipname = $ARGV[1]; } $zipname =~ s/\"//g; $zipname.=".zip" if ($zipname !~ /\.zip$/); $zip->zipfileComment("Zipping up images.\n Date of Zip: $today"); ($zip->writeToFileNamed("$zipname") eq 0) or die print "couldn\'t write to zip file. Reason: $!"; }