Quick backstory: I was using aria2c
to download a bunch of files, and I found myself manually juggling between multiple aria2c terminal sessions and keeping track of download links. I was frequently encountering scenarios like this, so I decided to streamline the process a bit.
The use case was straightforward: download content in batches, automate the process as much as possible, and use a simple tool that would work seamlessly across different platforms with minimal setup requirements and resources, and be able to work with a remote client, ssh
in my case.
I wanted to use an existing tool and found some batch downloaders for aria2c
on GitHub, but none of them quite matched my needs. So, I created my own solution.
For this, I chose Bash
as the tool of choice, due to its low setup requirements and created this simple script to facilitate the process.
The script works like this
- Have a
download_link.txt
file in the same directory as the script. This file would contain links separated by newline characters (\n). - The script reads each link line by line.
- Each link would be passed to
aria2c
, which initiates the download. The main script waits for the download to complete. - Once downloaded, the script removes the current link from the
download_link.txt
file - This process would repeat until all links’ content is downloaded.
You can find the full code on aria2c-packload
In usage, I only needed to add links to the download_link.txt
file:
https://example.com/download-link-1.zip
https://example.com/download-link-2.modal
and then start the downloader script:
$ chmod +x ./downloader.sh
$ ./downloader.sh
This approach saved me from managing multiple terminal sessions, download links etc. Plus it also works smoothly in a remote server without requiring additional setup (assuming aria2c
is already installed).
This has been a time-saver for me and maybe it helps you as well 😊.
Chow!