I have a web page which contains a link to a document. I'm able to download the document by using the following command:

wget -r -A.doc www.website.com/1.doc

However, I would like to provide the link to the page which contains the document and for wget to scan for the document link and download it.

Is there a way to use wget to scan for a specific link being a document type?


Something like this may work -

wget -r -l 2 -A doc,docx,odt http://example.com/page-to-scan.html

Recursively get the page at http://example.com/page-to-scan.html and follow all of the links on that page and bring in everything from the next level. And then throw away anything that doesn't end in .doc,.docx, or .odt (you mention document, so these are the 3 types - MS old, MS current, and Open|Libre Office)

  • Thanks, but this only retrieves the folder structure, no document...
    – mikimr
    Dec 2 '17 at 5:01

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.