Thanks for explaining it is a simple way, I have it working
sub compress { #subroutine to compress the directory tree in to backup.zip in the bac +kup location print "Backing up ".$STARTLOCATION."\n"; my $zip = Archive::Zip->new(); opendir (DIR, $STARTLOCATION) or die $!; while (my $file = readdir(DIR)) { # Use -f to look for a file next unless (-f $STARTLOCATION."\\".$file); $zip->addFile($STARTLOCATION."\\".$file, $file); print "Added $file to zip\n"; } closedir(DIR); unless ( $zip->writeToFileNamed($BACKUPNAME) == AZ_OK ) { die 'write error'; } print "Successfully backed up to ". $BACKUPNAME; }
In reply to Re^2: Problems with Archive::zip
by Martinw
in thread Problems with Archive::zip
by Martinw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |