[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] downloading files in multiple computer
From: |
Ángel González |
Subject: |
Re: [Bug-wget] downloading files in multiple computer |
Date: |
Fri, 26 Nov 2010 21:44:43 +0100 |
User-agent: |
Thunderbird |
Rahul Prasad wrote:
> Hi,
> I want to download a file partly in one computer and partly in another.
> then combine both of them and use it.
> Is it possible?
>
It can be worked out with a lot of kludges.
Could have been easier if wget supported downloads regardless of the
response status.
Suppose you want to download http://www.example.com/foo.txt which is 500
bytes
Start a normal download.
wget http://www.example.com/foo.txt
and interrumpt it at the middle with Ctrl+C
Now, look at the file size, which will be shown at wget output like:
Length: 500
And the file size of the incomplete file you downloaded. Eg. 10 bytes.
Now, you want to download the first half. Do
wget -c --header "Range: bytes=10-249" http://www.example.com/foo.txt
This will give you the first 500 bytes of the file.
For the second file, you will provide a fake beginning from which it
will continue;
truncate -s500 foo.txt
wget -c http://www.example.com/foo.txt
Finally, you need to overwrite the first 500 bytes of the second file
with those of the first one.
For instance:
( cat foo1.txt; tail -c +500 foo2.txt ) > real_foo.txt