Skip to content

Instantly share code, notes, and snippets.

@GeoffWilliams
Created November 21, 2014 11:00
Show Gist options
  • Select an option

  • Save GeoffWilliams/81e48fdb596767bcae5f to your computer and use it in GitHub Desktop.

Select an option

Save GeoffWilliams/81e48fdb596767bcae5f to your computer and use it in GitHub Desktop.
Download a directory of files from webserver and save to /shared directory - for setting up classrooms
#!/bin/bash
#
# download files from laptop webserver in VM to teach fundamentals module
# usage:
# ./classroom_files.sh DOWNLOAD_URL
#
# DOWNLOAD_URL should be a directory of files on an http server
BASE_URL=$1
DOWNLOAD_DIR="/shared"
WGET_COMMAND="wget -r -nH --cut-dirs=2 --no-parent --reject=index.html* --directory-prefix=${DOWNLOAD_DIR}"
if [ "$BASE_URL" == "" ] ; then
echo "Please supply a URL to download from"
exit 1
fi
$WGET_COMMAND $BASE_URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment