4

I'd like to use wget to download a tutorial in a website, but this tutorial is in a specific directory.

Suppose the URL is the tutorial main page http://www.abc.com/aaa/bbb/ccc/index.html.

But the as it contain "continuations" there are other pages I'd like to be interconected that are in directories such as:

http://www.abc.com/aaa/bbb/ccc/ddd/index.html

http://www.abc.com/aaa/bbb/ccc/eee/index.html

http://www.abc.com/aaa/bbb/ccc/fff/ggg/index.html

So, basically I need to download recursively the directories after ccc, but not before, and then convert the links to be used offline. There is any argument to be used with wget that would perform such task?

6

Try:

wget -r -np -k -p http://www.site.com/dir/page.html

The args (see man wget) are:

  • r Recurse into links, retrieving those pages too (this has a default max depth of 5, can be set with -l).
  • np Never enter a parent directory (i.e., don't follow a "home" link and mirror the whole site; this will prevent going above ccc in your example).
  • k Convert links relative to local copy.
  • p Get page-requisites like stylesheets (this is an exception to the np rule).

If I remember correctly, wget will create a directory named after the domain and put everything in there, but just in case try it from an empty PWD.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.