#!/usr/bin/perl -w use diagnostics; use File::Basename; use Cwd; my $dir = getcwd; use Archive::Zip qw/ :ERROR_CODES :CONSTANTS/; open (LOG, ">>ziplog.txt"); #Directory to be backed up my $sourcedir = 'temp'; #Location of where to backup and compress file to. my $zipfile = 'test.zip'; my $zip = Archive::Zip->new(); opendir(FH, $sourcedir); @backlist = grep { !/^\.\.?\z/ && -e "$sourcedir/$_" } readdir FH; foreach my $file(@backlist) { print(LOG "$file\n"); } $zip->writeToFileNamed($zipfile); $zip->addTree( 'temp', 'tempfolder' );