!/usr/bin/perl -w use strict; use List::Util qw(first); use Archive::Zip qw(:ERROR_CODES :CONSTANTS); my $input= 'D:\temp\sample'; my $outDir = 'D:\out\sample.zip'; my $obj = Archive::Zip->new(); $obj->addTree( $input ); # # Write the files to zip. if ($obj->writeToFileNamed($outDir) == AZ_OK) { # write to disk print "\n\nArchive created successfully!\n"; } else { print "Error while Zipping !"; }