The -k option (or --convert-link) will convert links in your web pages to relative after the download finishes, such as the man page says:

After the download is complete, convert the links in the document to make them suitable for local viewing. This affects not only the visible hyperlinks, but any part of the document that links to external content, such as embedded images, links to style sheets, hyperlinks to non-HTML content, etc.

So, if I didn't specify -k, can I run wget again after the download and fix that, and if so, what would be the proper command? My guess is wget -c [previous options used] [url] and run it in the same working directory as the file were downloaded to.

  • 1
    you could certainly post-process the files after download, but i don't know if wget does this. your idea of trying it with -c is a good one. time to experiment! Dec 7, 2009 at 21:08
  • Have a utility handy to convert the links, by any chance? Running on Windows, by the way...
    – Nathaniel
    Dec 7, 2009 at 21:14
  • perl ... no prewritten script, but if i wanted a DIY solution that's what i'd use Dec 7, 2009 at 21:48
  • Okay, thanks. Don't have Perl installed and it would take too long to grab it. Fortunately, I found how to make wget do the job. I posted an answer.
    – Nathaniel
    Dec 7, 2009 at 21:52
  • btw, ActivePerl is around as a windows perl port; it's a fairly small installer, and i'm pretty sure most CPAN modules work with it. activestate.com/activeperl Dec 8, 2009 at 15:47

1 Answer 1


Yes, you can make wget do it. I'd say use wget -nc -k [previous options] [previous url]. -nc is no-clobber. From the man page:

When −nc is specified, this behavior is suppressed, and Wget will refuse to download newer copies of file.

And the -k option does the link converting. So, wget starts digging in the remote server, sees all the files you already have, refuses to redownload them, and then edits the HTML links to relative when it's done. Nice.

  • 4
    No this doesn't work for me. He download the first file (e.g. index.html), see that is allready downloaded an stop. If you want wget working recursive you have to use the timestamp (-K) option. So wget must request all headers to match if the file is newer or not.
    – user89733
    Jul 10, 2011 at 21:51
  • 15
    GNU Wget 1.13.3 built on darwin11.1.0. Trying to use both options at the same time gives Both --no-clobber and --convert-links were specified,only --convert-links will be used. Dec 29, 2011 at 4:05
  • 2
    didn't your question ask for without -k?
    – barlop
    Jan 21, 2012 at 1:34
  • 8
    Cf. @LudovicKuty's comment -- as of wget 1.13 --no-clobber doesn't work with --convert-links. See http://savannah.gnu.org/bugs/?31781 for details. Feb 26, 2013 at 20:37
  • 1
    In case anyone cares, I built a docker image for wget 1.12: hub.docker.com/r/berezovskyi/wget1.12 Dec 3, 2017 at 11:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .