Snippets are tiny notes I've collected for easy reference.
Backup or mirror a website using wget
To create a local mirror or backup of a website with wget, run:
wget -r -l 5 -k -w 1 --random-wait <URL>
Where:
-r(or--recursive) will causewgetto recursively download files-l N(or--level=N) will limit recursion to at most N levels below the root document (defaults to 5, useinffor infinite recursion)-k(or--convert-links) will causewgetto convert links in the downloaded documents so that the files can be viewed locally-w(or--wait=N) will causewgetto wait N seconds between requests--random-waitwill causewgetto randomly vary the wait time to0.5xto1.5xthe value specified by--wait
Some additional notes:
--mirror(or-m) can be used as a shortcut for-r -N -l inf --no-remove-listingwhich enables infinite recursion and preserves both the server timestamps and FTP directory listings.-np(--no-parent) can be used to limitwgetto files below a specific "directory" (path).
Published 10 Feb 2014
Snippets are tiny notes I've collected for easy reference.
