[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: perl and apache
Chetan Gopal Kashinath wrote:
> hi,
>
> this is a query that i am posting for a friend.
>
> he is creating a zip file through perl on apache server on linux.
> here is the code
>
> The code will be like this:
> <start of code>
>
> push ( @list, "gzip");
> push ( @list, "zipfile.zip");
> push ( @list, "*.*");
>
> exec "@list";
>
> <end of code>
>
> he says that the file is not being created. is such a thing allowed?? if it
> is then where is the file created.
>
> if the entire approach is wrong, how to tackle the prob
>
> thank you
> - chetu
> -----------------------------------------------------------------------
> For information on this and other Linux India mailing lists check out
> http://lists.linux-india.org/
hi chetu,
The notation is correct but the usage of gzip is wrong.
Modified code is:
< begin of file 1.pl>
#!/usr/bin/perl
push ( @list, "gzip");
push ( @list, "-c");
push ( @list, "*");
push ( @list, ">zipfile.gz");
exec "@list";
<end of file 1.pl>
This code will compress all the files in the curent directory and store into
zipfile.gz.
when u extract/uncompress the zipfile.gz u will see only one file while
contains all the files data.
To extract into separate files ,
the code for compressing files:
< begin of file conpress.pl>
#!/usr/bin/perl
push ( @list, "tar");
push ( @list, "zcvf");
push ( @list, "tarandzipedfile.tar.gz");
push ( @list, "*");
exec "@list";
<end of file compress.pl>
For uncompress/extraction :
< begin of file extract.pl>
#!/usr/bin/perl
push ( @list, "tar");
push ( @list, "zxvf");
push ( @list, "tarandzipedfile.tar.gz");
exec "@list";
<end of file extract.pl>
I hope this will help u.....
Bye
Ravi Prakash B.V.