I'm trying to download an entire site with
wget like this:
wget -r http://whatever/
wget -m http://whatever/
But it only downloads the pages with text, no images. How can I download the pages with text and images? What am I missing here?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
wget command you'll need to use is much lengthier as explained below. As such, you may wish to commit it to a file like
wholesite.sh, make it an executable, and run it. It'll create a directory of the url and subdirectories of the site's assets, including images, js, css, etc.
wget \ --recursive \ --level 5 \ --no-clobber \ --page-requisites \ --adjust-extension \ --span-hosts \ --convert-links \ --restrict-file-names=windows \ --domains yoursite.com \ --no-parent \ yoursite.com
--recursive This specifies how many subdirectories of the site's assets you want to retrieve(since assets like images are often kept in subdirectories of the site) The default max depth to search for assets is 5 subdirectories. You can modify this with the
level flag just below.
--level 5 Search through 5 subdirectories for assets. I'd recommend increasing or decreasing this if the target site is larger or smaller respectively.
--no-clobber Don't overwrite existing files.
wget to download all the files that are necessary to properly display a given HTML page which includes images, css, js, etc.
--adjust-extension Preserves proper file extensions for .html, .css, and other assets.
--span-hosts Include necessary assets from offsite as well.
--convert-links Update site links to work as files within subdirectories on your local machine(for viewing locally).
--restrict-file-names=windows Modify filenames to work in Windows as well, in case you're using this command on a Windows system.
--domains yoursite.com Do not follow links outside this domain.
--no-parent Don't follow links outside the directory you pass in.
yoursite.com # The URL to download