Skip to content

Instantly share code, notes, and snippets.

@kkleidal
Last active August 29, 2015 14:21
Show Gist options
  • Save kkleidal/2c49a81776f7b0d40121 to your computer and use it in GitHub Desktop.
Save kkleidal/2c49a81776f7b0d40121 to your computer and use it in GitHub Desktop.
FileListDownloader
#!/bin/bash
DIR=$(pwd)
DELIMETER="\t"
DOWNLOADS_FILE=$1
DOWNLOAD_TO=$2
MY_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
PRIVATE_KEY=$MY_DIR/mitKeyStore.pem
cd $DOWNLOAD_TO
if [ $? -ne 0 ]; then
echo "Could not cd to $DOWNLOAD_TO" >&2
cd $DIR
exit 1
fi
while read URL_NAME; do
echo $URL_NAME
arrIN=(${URL_NAME//$DELIMETER/ })
URL=${arrIN[0]}
NAME=${arrIN[1]}
wget --private-key=$PRIVATE_KEY -O $NAME $URL
done < $DOWNLOADS_FILE
cd $DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment