Writing the below test script for a Window 2008 server but seem to be having a few issues.
I need to add a folder and all the folders below it to a Zip Archive and produce a list of all folders below the parent. I can list the output and create the Archive Zip file but it doesn’t seem to want to add the folders to the Zip file.
Any help would be appreciated.#!/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' );
In reply to Archive Zip by muizelaar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |