I have a perl CGI script that munges a text input and returns one or more output files.
Because these files are being delivered from a web server, with a specific directory set for CGI scripts to write to, the resulting zip file also contains that hierarchy eg:
#/usr/bin/perl use strict; use use IO::Compress::Zip qw(zip $ZipError); my $tmpfiles = '/home/webfiles/tmpfiles'; open ($FH1,'>, $tmpfiles.'/file1.txt'); open ($FH2,'>, $tmpfiles.'/file2.txt'); # do stuff here to write to $FH1 and $FH2 close $FH1; close $FH2; zip [$tmpfiles.'/file1.txt',$tmpfiles.'file2.txt'] =>$tmpfiles.'/outpu +t.zip'; exit;
When 'output.zip' is uncompressed you end up with:
Is there any way to create the zip file without the enclosing directory hierarchy?home/ webfiles/ tmpfiles/ file1.txt file2.txt
In reply to Zip only files, not directory hierarchy. by desertrat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |