On 31/05/2011 07:15, Agnello George wrote:
HI


i am given ever day a list of files  which i wget  within a parent folder .

my  team gives me    a structure where theses files are located

================
cat /home/upload_files1.txt
download the files form wget http://localserver/website1  and upload on
http://prodserver/weebsite1

index.php
dualfilder/dual.templ  dual_2.templ
go/go.php
go/numbers/123.php
data/data.php
===============


using the above data given to me  i check whether the files exist  and if
they do i download them

wget http://localserver/website1/index.php
wget http://localserver/website1/dualfilder/dual.templ
wget http://localserver/website1/dualfilder/dual_2.templ
wget http://localserver/website1/go/go.php
wget http://localserver/website1/go/numbers/123.php
wget http://localserver/website1/data/data.php

and its downloaded in the   /temp/  dir :

ls

index.php 123.php  dual.templ  dual_2.templ  go.php data.txt

i need to create a tar of this in the same given format

index.php
dualfilder/dual.templ  dual_2.templ
go/go.php
go/numbers/123.php
data/data.php


i cant seem to come up with a a logic on how to get this done .. can some
one help me kick start  a idea on how to preceded .

From what you have written, it sounds like you have already got the
download part in place. (If not, or you would like to take a walk
through your code, then please post again.)

You are best off using an established module to write the tar file
(indeed, unless you are already committed to it, you should use the Perl
LWP module over calls to wget) and Archive::Tar works just fine.

For instance:

use strict;
use warnings;

use Archive::Tar;

my @tarfiles;


# Download remote files and push them onto the @tarfiles array.

Archive::Tar->create_archive('tarfile.tar', undef, @tarfiles) or die Archive::Tar->error;

__END__


HTH,

Rob

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to