in reply to Script waiting on 'Press any key to continue'
Here is a function that I use in my scripts (it might be not the best way to do it, but it works...)
sub ZipFile($) { my $fname = @_[0]; my $error = 0; my $zipfile = $fname.'.zip'; #Update filename, add .ZIP at the end my $zip = Archive::Zip -> new(); my $member = $zip->memberNamed( $fname ); if ($member eq undef) #No existing zip file with the file inside { $member = $zip->addFile( $fname ) or $error = 1; #Add file to ZI +P archive push @ERRORS, "Unable to zip $fname: $!\n" if $error; LogError() if $error; } $member -> desiredCompressionLevel( 9 ); my $status = $zip -> overwriteAs($zipfile); push @LOG, "$fname compressed (zipped) successfully\n"; return $zipfile; #Return updated filename }
Hope this helps :)
--------------------------------
An idea is not responsible for the people who believe in it...
|
|---|