All pastes #210707 Raw Edit

getfile.py

public python v1 · immutable
#210707 ·published 2006-10-19 23:04 UTC
rendered paste body
#!/usr/bin/pythonfrom os import popen, systemurl = "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 lengthlength = int(bq("curl %s -I | grep Content-Length:" % url)[16:])lby4 = length / 4print "Length: %s (4 chunks of %s)" % (length, lby4)#downloadsystem('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 filesystem('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')