Gossamer Forum
Home : General : Perl Programming :

unzip zipped txt-files in perl

Quote Reply
unzip zipped txt-files in perl
Hi,

at the moment I'm downloading some txt- and csv-files from other server and save them on mine using the




use LWP::Simple;

$rc = getstore( "http://www.xxx.de/xxx/artikel/BNARTIKEL.txt", "/var/www/html/xxx/temp/BNARTIKEL.txt" );




method.



What I now what to know is how to do nearly the same with zipped txt-files.

The point is that I want to unzip them (via perl-cgi) before or after saving the file on my server.

Something like:






use LWP::Simple;

$rc = getstore( http://www.xxx.de/...rtikel/BNARTIKEL.zip, "/var/www/html/xxx/temp/BNARTIKEL.zip" );

UNZIP "/var/www/html/xxx/temp/BNARTIKEL.zip" AND SAVE AS "/var/www/html/xxx/temp/BNARTIKEL.txt"




Does anyone have an idea how to do that ??



Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [ManuGermany] unzip zipped txt-files in perl In reply to
If you have unzip on your server then it's almost as you had it....

Code:
system("unzip BNARTIKEL.zip") == 0 or die "Couldn't unzip: $?";

Last edited by:

Paul: Mar 12, 2003, 5:17 AM
Quote Reply
Re: [Paul] unzip zipped txt-files in perl In reply to
In Reply To:
If you have unzip on your server then it's almost as you had it....

Code:
system("unzip BNARTIKEL.zip") == 0 or die "Couldn't unzip: $?";


Thanks,

but how do I have to set the correct path to BNARTIKEL.zip ?

I've tried:





$rc = getstore( "http://www.xxx.de/partner/produkte_xl.zip", "/var/www/html/xx/temp/produkte_xl.zip" );


system("unzip
/var/www/html/xx/temp/produkte_xl.zip") == 0 or die "Couldn't unzip: $?";




And I get the following error:

Premature end of script headers: /var/www/cgi-bin/xx/xx.cgi

Couldn't unzip: -1 at /var/www/cgi-bin/produktbase/xx.cgi line 11.





Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.

Last edited by:

ManuGermany: Mar 12, 2003, 5:34 AM
Quote Reply
Re: [ManuGermany] unzip zipped txt-files in perl In reply to
Are you sure you have unzip installed?....it is a non standard binary so your host may not have it.
Quote Reply
Re: [Paul] unzip zipped txt-files in perl In reply to
surely you're right (by the way I have my own server).

where can i get the unzip module?

I just can't find it at cpan.

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [ManuGermany] unzip zipped txt-files in perl In reply to
It's not a perl module, it's a binary:

http://www.rpmfind.net/...arch.php?query=unzip

Last edited by:

Paul: Mar 12, 2003, 6:30 AM