Last active
August 29, 2015 14:21
-
-
Save kkleidal/2c49a81776f7b0d40121 to your computer and use it in GitHub Desktop.
FileListDownloader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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