Friday, December 28, 2007

Batch Download Scripts

Here's a pair of scripts I keep for batch downloading. The first is to download a list of stuff that is passed to it, called grab.sh:

#!/bin/bash

while read i; do wget -c --tries=0 $i; done

The next script called downloadlist.sh calls the first and sends an email when done:

#!/bin/bash

cat $1 | grab.sh
echo "Your downloads are done" | mail -s "Download notifier" myname@myemail.com

Just invoke it by passing it a file that contains a list of URLs to download, like so:

$ ./downloadlist.sh listofurls


It's brain-dead simple, but since I'm lousy at remembering stuff I am writing it here for my own reference.

No comments: