To download a webpage ( its html file and other files needed by it), wget seems to mirror the directory structure of the files of the webpage on the website server

When in a web browser (e.g. Firefox or Chrome), by hitting Ctrl-s, we creates a html file and a directory named something like ..._files which contains all needed files by the webpage, and change the links to the needed files in the html file accordingly.

I wonder if the second approach can be done in command line by some program? Can wget do that? Can Firefox or Chrome be used from command line?

  • May this topic at superuser be useful – sebelk Jun 18 '15 at 14:26
  • Here's a guess as to what's going on. As you know, wget -p will download what is needed for the webpage to display offline - like its source code. References to external files are embedded in the webpage source. If they were downloaded in another directory structure, then all those references would have to be modified to reflect that. When a browser looks at a webpage, it renders it into a displayable whole - like compiled code. It has used the files and has the result. It is in a very different situation than wget is, so it may be able to save the result rather than the initial input. – Joe Jun 20 '15 at 2:38

Your Answer

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

Browse other questions tagged or ask your own question.