#!/usr/bin/python from os import popen, system url = "http://ftp.gnu.org/pub/gnu/aspell-dict-it/aspell6-it-2.2_20050523-0.tar.bz2" def bq(cl): return popen(cl, 'r').read() #get length length = int(bq("curl %s -I | grep Content-Length:" % url)[16:]) lby4 = length / 4 print "Length: %s (4 chunks of %s)" % (length, lby4) #download system('curl -r 0-%s %s -o filename.part1 -w finished' % (lby4, url)) system('curl -r %s-%s %s -o filename.part2 -w finished' % (lby4+1,lby4*2, url)) system('curl -r %s-%s %s -o filename.part3 -w finished' % (lby4*2+1,lby4*3, url)) system('curl -r %s- %s -o filename.part4 -w finished' % (lby4*3+1, url)) #reasemble file system('touch file.tar.bz2') system('cat filename.part1 > file.tar.bz2') system('cat filename.part2 >> file.tar.bz2') system('cat filename.part3 >> file.tar.bz2') system('cat filename.part4 >> file.tar.bz2')