I would like to download a SQL tutorial here http://www.w3schools.com/sql/default.asp, as a book with all linked SQL related sections.

Here is my command

wget -r -np -nH  -p -k  http://www.w3schools.com/sql/default.asp

Under the downloaded sql directory, I get some asp files, which I don't know how to open in Chrome.

Did I download the webpages correctly? How shall I do? Thanks!

  • 3
    Why would anyone download w3schools books? – Braiam Sep 13 '14 at 15:35
  • Why not? Do you have recommendations for learning SQL? – Tim Sep 13 '14 at 15:38

I would use an appropriate tool such as httrack and not waste my time in trying to coax this out of a tool such as wget or curl. Here's how you can download the URL that you're asking about, I did it myself and it even works just fine in Chrome!

$ httrack http://www.w3schools.com/sql/default.asp
Mirror launched on Sat, 13 Sep 2014 22:50:32 by HTTrack Website Copier/3.48-19 [XR&CO'2014]
mirroring http://www.w3schools.com/sql/default.asp with the wizard help..
Done.57: www.w3schools.com/sql/trysql_view.asp?x= (0 bytes) - OK
Thanks for using HTTrack!

After it's complete I'm left with the following directory structure:

$ ls -l
total 36
-rw-r--r--. 1 slm slm 4243 Sep 13 22:50 backblue.gif
-rw-rw-r--. 1 slm slm  181 Sep 13 22:51 cookies.txt
-rw-r--r--. 1 slm slm  828 Sep 13 22:50 fade.gif
drwx------. 2 slm slm 4096 Sep 13 22:51 hts-cache
-rw-rw-r--. 1 slm slm  736 Sep 13 22:51 hts-log.txt
-rw-r--r--. 1 slm slm 5057 Sep 13 22:50 index.html
drwxr-xr-x. 3 slm slm 4096 Sep 13 22:50 www.w3schools.com

To check things out simply navigate to the index.html file at the root level and you'll be greeted with the following page:


Clicking the link will take you to your downloaded pages:


And just for measure, here I'm clicking one of the side links to demonstrate that it can navigate just fine.



  • Do you know how to convert the downloaded html files into a pdf file? – Tim Sep 14 '14 at 18:24

First you should copy your current working directory to a test directory for dry-run and try this below.

You should then run:

this should convert file to an html response from an asp page (getting webserver response with -O command and put the page to a filename.html file after fetching)

  wget -O filename.html http://www.w3schools.com/sql/default.asp

then replace the extension names from the pages

  for f in *.old_file_extention; do mv $f `basename $f to .new_file_extension; done;

then replace file linkings to .html from .asp linkings from pages in all .html pages

  sed -i 's/.asp/.html/' *.html 

try that; then you should be able to open up your webpages with links
working correctly. you may need to work something out with the first command because it only gets one page at a time. You have to combine what you have.

  • Chome reads .html output – unixmiah Sep 15 '14 at 7:42
  • When I tried: sudo wget -r w3schools.com/sql, it downloaded entire website to /www.w3schools.com folder, you can try to convert all .asp to .html files with the commands above – unixmiah Sep 15 '14 at 7:49
  • httrack sounds like a good soulution. what I have is a way to do it if there wasn't any httrack – unixmiah Sep 15 '14 at 7:55

Try to :

wget -r http://www.w3schools.com/sql

Yes i got result

I have the following dirs and files:

mohsen@debian:~/offline docs/www.w3schools.com$ ls
about  angular  aspnet  bootstrap  css  default.asp  favicon.ico  forum  html  index.html  jquery  js  php  robots.txt  sitemap  sql  stdtheme.css  xml
  • do you get asp files? – Tim Sep 13 '14 at 15:49
  • i got a set of *.asp as html format, Why do you need asp? – PersianGulf Sep 13 '14 at 15:50
  • some of asp file are downloaded : mohsen@debian:~/offline docs/www.w3schools.com$ ls sql/ default.asp sql_and_or.asp sql_distinct.asp sql_insert.asp sql_intro.asp sql_orderby.asp sql_select.asp sql_syntax.asp sql_update.asp sql_where.asp – PersianGulf Sep 13 '14 at 15:54
  • You have to use them as html file. – PersianGulf Sep 13 '14 at 15:55
  • How to use asp as html? – Tim Sep 13 '14 at 16:08

This may be an short answer and hopefully it'll help. I would wget the .asp file and then rename it to an file with a .html extension. This will take the .asp html output and open the file as .html in a browser.

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.