Skip to content

Instantly share code, notes, and snippets.

@sijpkes
Last active September 19, 2017 00:35
Show Gist options
  • Save sijpkes/58536b6946807fd57d7fcb30827300a0 to your computer and use it in GitHub Desktop.
Save sijpkes/58536b6946807fd57d7fcb30827300a0 to your computer and use it in GitHub Desktop.
edX ZIP file download, extraction and decryption - edX_zip_extract.sh yyyy-mm-dd filename.sql
#!/bin/bash
# ensure you have a _data and decrypted folder defined in this dir.
date=$1
ZFILE=newcastlex-$date.zip
ENC_FILE=$2
#have a
if [ -f _data/$ZFILE ]; then
echo "File $ZFILE already downloaded.."
else
echo "Downloading file $ZFILE..."
aws s3 cp s3://course-data/$ZFILE _data/
fi
if [ -f _data/newcastlex-$date ]; then
echo "File $ZFILE has already been processed."
else
tar xzf _data/$ZFILE -C _data/
fi
echo "Done and ready."
if [ -f decrypted/$date ]; then
echo "Decryption folder exists"
else
echo "Decrypting..."
mkdir -p decrypted/$date
fi
gpg --output decrypted/$date/$ENC_FILE --decrypt _data/newcastlex-$date/$ENC_FILE
#use your fav text editor here
brackets decrypted/$date/$ENC_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment