Skip to content

Instantly share code, notes, and snippets.

@faebser
Created February 21, 2014 00:38
Show Gist options
  • Save faebser/9126582 to your computer and use it in GitHub Desktop.
Save faebser/9126582 to your computer and use it in GitHub Desktop.
boomkat download script with automatic unzipping and removal
#!/bin/bash
# run like this ./boomkat.sh https://downloads.boomkat.com/adcaxxxxx
SAVEPATH="path/to/extract/to/with/trailing/slash"
if [ -z "$1" ]; then
echo "ERROR: no boomkat-link in input"
exit 1
fi
echo "getting filename"
header="`wget --spider --server-response "$1" 2>&1 | grep -i content-disposition`"
IFS=\" read -a filename <<<"$header"
IFS=\- read -a meta <<<"${filename[1]}"
IFS=\. read -a title <<<"${meta[2]}"
targetFolderName="$SAVEPATH${meta[1]}-$title"
wget --content-disposition "$1"
unzip "${filename[1]}" -d "$targetFolderName"
rm -v "${filename[1]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment