Hi,

I am trying to fetch various docs from server using wget. Below is the code
Files are downloading but of 0 size :(

Am i missing any thing

[EMAIL PROTECTED]:~/adave> cat fetch.pl
open(S,"<./source.txt") || die "Failed to open file 'source.txt' $!";
while(<S>)
{

if (/http/)
        {
                @a=split(/\//,$_);
                $file=$a[-1];
                $r=exec `/usr/bin/wget $_ >./$file `;
                print $r;
                print "Printing the output of last $?";
                exit;
        }
}
close(S);
[EMAIL PROTECTED]:~/adave> perl fetch.pl
--18:03:19--  http://localhost/training_files/docs/overview.ppt
           => `overview.ppt'
Resolving localhost... x.x.x.x.
Connecting to localhost x.x.x.x... connected.
HTTP request sent, awaiting response... 200 OK
Length: 145,920 [application/vnd.ms-powerpoint]

100%[==================================================================================================================>]
145,920       81.61K/s

18:03:21 (81.43 KB/s) - `overview.ppt' saved [145920/145920]

0Printing the output of last [EMAIL PROTECTED]:~/adave> ls -l
total 5
-rw-r--r--  1 adave aix  254 2008-07-22 17:48 fetch.pl
-rw-r--r--  1 adave aix 4074 2008-07-22 16:52 source.txt
-rw-r--r--  1 adave aix    0 2008-07-22 18:03 overview.ppt



Thanks,
a b

Reply via email to