On Saturday 27 November 2010 02:14 AM, Ángel González wrote:
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

Problem problem problem :(

i tried partially downloaded a file and terminated download by pressing Ctrl+c After that when I tried setting header to download rest of the file it kept on retrying.
Here is an output

ra...@rahul-laptop:~$ wget -c --header "Range: bytes=505137-12973463" --server-response http://noya.co.in/download.zip
--2010-11-27 20:29:23--  http://noya.co.in/download.zip
Resolving noya.co.in... 67.228.53.112
Connecting to noya.co.in|67.228.53.112|:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 206 Partial Content
  Date: Sat, 27 Nov 2010 15:00:00 GMT
Server: Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
  Last-Modified: Tue, 13 Jul 2010 05:04:51 GMT
  ETag: "55482ce-c5f597-48b3dcf1ea2c0"
  Accept-Ranges: bytes
  Content-Length: 12468326
  Content-Range: bytes 505137-12973462/12973463
  Keep-Alive: timeout=8
  Connection: Keep-Alive
  Content-Type: application/zip
Retrying.

--2010-11-27 20:30:05--  (try: 2)  http://noya.co.in/download.zip
Connecting to noya.co.in|67.228.53.112|:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 206 Partial Content
  Date: Sat, 27 Nov 2010 15:00:14 GMT
Server: Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
  Last-Modified: Tue, 13 Jul 2010 05:04:51 GMT
  ETag: "55482ce-c5f597-48b3dcf1ea2c0"
  Accept-Ranges: bytes
  Content-Length: 12468326
  Content-Range: bytes 505137-12973462/12973463
  Keep-Alive: timeout=8
  Connection: Keep-Alive
  Content-Type: application/zip
Retrying.

--2010-11-27 20:30:23--  (try: 3)  http://noya.co.in/download.zip
Connecting to noya.co.in|67.228.53.112|:80... ^C

________________________


but when I tried downloading using -c It worked
Here is an output
ra...@rahul-laptop:~$ wget -c --server-response http://noya.co.in/download.zip
--2010-11-27 20:30:35--  http://noya.co.in/download.zip
Resolving noya.co.in... 67.228.53.112
Connecting to noya.co.in|67.228.53.112|:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 206 Partial Content
  Date: Sat, 27 Nov 2010 15:01:21 GMT
Server: Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
  Last-Modified: Tue, 13 Jul 2010 05:04:51 GMT
  ETag: "55482ce-c5f597-48b3dcf1ea2c0"
  Accept-Ranges: bytes
  Content-Length: 12466946
  Content-Range: bytes 506517-12973462/12973463
  Keep-Alive: timeout=8
  Connection: Keep-Alive
  Content-Type: application/zip
Length: 12973463 (12M), 12466946 (12M) remaining [application/zip]
Saving to: `download.zip'

 3% [++++++                     ] 5,12,956    1.13K/s  eta 6h 39m  ^C

Check the response header, its same in both the case still First method does not work.

You may think my problem is solved if I use -c so I shouldnt try setting header "Range". But my problem is downloading same file partially in multiple computers and then combining it.

Simply put, I want to intentionally download contents partially. is there any way I can do so using wget?

--
Regards,
Rahul Prasad
web: rahulprasad.com
Mo: +91 98358 51676


Reply via email to