utilities  

Oct 15, 2014 • Michael Chen

I was assigned by my professor to download some RNA sequences data to my own computer for backup purpose, because the original data server will clean these data. These data are dozens gigabytes in size, but the connection speed of the network in my house is not fast. Therefore, I chose lftp to speed up the downloading rate by parallel downloading.

lftp is a sophisticated ftp/http client and a file transfer program supporting several network protocols, e.g. FTP, FTPS, HTTP, HTTPS, HFTP, FISH, SFTP, torrent file and so on. lftp can be run interactively or in batch mode. You can write simple or complex commands to run lftp in a script file.

The basic lftp command is like this:

$ lftp -e "get -c http://releases.ubuntu.com/14.04.1/ubuntu-14.04.1-desktop-amd64.iso"

get means the action of downloading. -c means continuing previous download files.

If you need to download several files, you need the command mget, which supports wildcard expansion.

$ lftp -e "mget -c http://releases.ubuntu.com/14.04.1/*.iso"

If you need to download files in parallel, replace get with pget; set mirror:use-pget-n (number).

$ lftp -e "set mirror:use-pget-n 3; pget -c http://releases.ubuntu.com/14.04.1/ubuntu-14.04.1-desktop-amd64.iso"

If you need more commands, separate them with ;(semicolon):

$ lftp -e "get -c http://releases.ubuntu.com/14.04.1/ubuntu-14.04.1-desktop-amd64.iso; get -c http://releases.ubuntu.com/14.04.1/ubuntu-14.04-server-amd64.iso"

Be aware of the risk of being banned while downloading in parallel, so use the feature in caution. Therefore, I downloaded these data to an intermediate server and, later, fetched them to my own computer. The intermediate server was a droplet of DigitalOcean. The downloading speed on the droplet counts in dozens megabytes, so it wouldn’t spend you too much time downloading to the droplet. Then, you can download these data again in parallel without overloading the original data server.

The rent fee of the droplet of DigitalOcean is charged in hours, so it won’t cost you too much to rent a temporatory server. You may try DigitalOcean or other similar virtual server hosting providers like Linode. If you need the promote code of DigitalOcean, use this link.