Skip to content

Instantly share code, notes, and snippets.

@johnie
Last active August 29, 2015 14:12
Show Gist options
  • Save johnie/b8bd9301d924f02256b6 to your computer and use it in GitHub Desktop.
Save johnie/b8bd9301d924f02256b6 to your computer and use it in GitHub Desktop.
Download website with wget
#!/bin/bash
if [ -z "$1" ]
then
echo "Which website would like to download?"
exit 1
fi
wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--restrict-file-names=windows \
--domains $1 \
--no-parent \
$1
# --recursive: download the entire Web site.
#
# --domains domain.com: don't follow links outside domain.com.
#
# --no-parent: don't follow links outside a directory.
#
# --page-requisites: get all the elements that compose the page (images, CSS and so on).
#
# --html-extension: save files with the .html extension.
#
# --convert-links: convert links so that they work locally, off-line.
#
# --restrict-file-names=windows: modify filenames so that they will work in Windows as well.
#
# --no-clobber: don't overwrite any existing files (used in case the download is interrupted and resumed).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment