fulmar2 has asked for the wisdom of the Perl Monks concerning the following question:
Second Methoduse Archive::Zip; my $zip = Archive::Zip->new(); # new instance $zip->addTreeMatching( "/$NewHomePath/Results/$InvoiceNumber", + "$InvoiceNumber", '\.(ab1$|seq$)' ); print "Content-Type:application/zip\n"; print "Content-Disposition:attachment;filename=$FileNameToWrit +e\n\n"; $zip->writeToFileHandle(*STDOUT);
use Archive::Zip; my $zip = Archive::Zip->new(); # new instance chdir("/$NewHomePath/Results"); @files = (<$InvoiceNumber/*.ab1>); # files to store @filesA = (<$InvoiceNumber/*.seq>); # files to store push (@files,@filesA); #PRINT HEADER print "Content-Type:application/zip\n"; print "Content-Disposition:attachment;filename=$FileNameToWrit +e\n\n"; #NOW PRINT TO STDOUT foreach $file (@files) { if ($DLWOSC eq "checked"){ $TranslatedName=(split('/',$file))[-1]; $TranslatedName=~s/\;/\_/g; $zip->addFile($file,$TranslatedName); # add files $zip->writeToFileHandle(*STDOUT); }else{ $zip->addFile($file); $zip->writeToFileHandle(*STDOUT); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Creating Zip Archives on the fly
by pmqs (Friar) on Oct 05, 2011 at 15:42 UTC | |
by fulmar2 (Initiate) on Oct 05, 2011 at 17:04 UTC | |
by pmqs (Friar) on Oct 29, 2011 at 12:23 UTC | |
by Anonymous Monk on Sep 12, 2013 at 17:12 UTC | |
|
Re: Creating Zip Archives on the fly
by Rozman (Initiate) on Sep 22, 2017 at 06:05 UTC | |
|
Re: Creating Zip Archives on the fly
by pvaldes (Chaplain) on Oct 04, 2011 at 22:53 UTC |