desertrat has asked for the wisdom of the Perl Monks concerning the following question:
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Zip only files, not directory hierarchy.
by MidLifeXis (Monsignor) on May 13, 2014 at 20:43 UTC | |
by desertrat (Sexton) on May 13, 2014 at 21:05 UTC | |
Re: Zip only files, not directory hierarchy.
by GotToBTru (Prior) on May 13, 2014 at 21:01 UTC | |
by desertrat (Sexton) on May 13, 2014 at 21:08 UTC | |
Re: Zip only files, not directory hierarchy.
by mhearse (Chaplain) on May 13, 2014 at 23:39 UTC | |
Re: Zip only files, not directory hierarchy.
by admiral_grinder (Pilgrim) on May 14, 2014 at 14:22 UTC | |
Re: Zip only files, not directory hierarchy.
by pmqs (Friar) on May 14, 2014 at 18:48 UTC | |
Re: Zip only files, not directory hierarchy.
by linuxer (Curate) on May 14, 2014 at 18:39 UTC |
Back to
Seekers of Perl Wisdom