This Bash script utilizes the wget
command to download a complete website along with its assets such as images, JavaScript files, CSS files, etc. The script organizes the downloaded content into a directory structure based on the domain of the specified URL.
- Ensure that the
wget
command is installed on your system. If not, you can install it using your system's package manager.
brew install wget
sudo apt-get update
sudo apt-get install wget
-
Clone or download the
wholesite.sh
script to your local machine. -
Make the script executable
chmod +x wholesite.sh
- Run the script by providing the URL of the website you want to download
./wholesite.sh http://example.com
Replace http://example.com
with the actual URL of the website you want to download.
- The script will create a directory based on the domain and download the entire website along with its assets into that directory.
--recursive
: Download recursively.--level 5
: Set the maximum recursion level to 5.--no-clobber
: Skip downloading files that already exist.--page-requisites
: Download page requisites, including inline images.--adjust-extension
: Add suitable extensions to filenames.--span-hosts
: Enable spanning across hosts when doing recursive retrieving.--convert-links
: Convert links to make them suitable for local viewing.--restrict-file-names=windows
: Modify filenames to be compatible with Windows.--domains
: Specify the domain(s) to limit downloading to.--no-parent
: Do not ascend to the parent directory when retrieving recursively.
- Archiving a website for offline viewing.
- Creating a local copy of a website for development or testing purposes.