Skip to content

Instantly share code, notes, and snippets.

Last active August 20, 2018 09:00
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Toledo/Blackboard Gradebook Unzipper, Unix Style.
# toledounzip
# usage: toledounzip gradebook_B-KSL-JLW323-1314_LABO04\ \(LW6\ -\ LW7\).zip
function toledounzipmain() {
if (( $# != 1 )); then
echo "Please provide the name of a .zip file generated by Toledo";
if [ ! -f "$1" ]; then
echo "Invalid filename";
echo "=== Start unzipping main zip “$1”";
unzip "$1" > /dev/null;
rm "$1";
echo "=== Done unzipping main zip “$1”";
echo "=== Start unzipping single zips";
echo "=== Done unzipping single zips";
function toledounzipsingles() {
for filename in *.txt; do NAME=$(head -n 1 "$filename" | sed 's/Naam: //g'); BASENAME=$(echo $filename | sed 's/.txt//g'); find . -type f -name "$BASENAME*.zip" -exec echo "- unzipping single “{}” by $NAME" \; -exec mkdir "$NAME" \; -exec tar -xzf "{}" --exclude="*__MACOSX*" --exclude="*.DS_Store" -C "$NAME" \; -exec rm "{}" \; -exec rm "$BASENAME.txt" \;; done;
alias toledounzip="toledounzipmain"
Copy link

bramus commented Apr 24, 2014

Add this to your .bash_profile or .bashrc
Usage: toledounzip gradebook_B-KSL-JLW323-1314_LABO04\ \(LW6\ -\ LW7\).zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment