Expected behavior: after downloading a file with wget, -k should convert the
output file that has been specified with -O.

Actual behavior: after downloading a file with wget, -k attempts to open the
default filename, regardless of the name that has been specified with -O.  This
results in an error since the default filename does not exist when the user has
specified another filename with -O.

Details:

I would like to download a web page and convert any links in the page to include
the host name and absolute path of the location they point to.

For example "/images/something.gif" should be converted to
"http://www.hostname.com/images/something.gif";.

This is what the -k option does...

wget -k \
--post-data 'categories=NC000103&desctgl_state=full' \
http://158.careersite.com/candidate/processcandquicksearch

This does exactly what it is supposed to.  It downloads the page
"processcandquicksearch" and adds the proper hostname to all links so that the
page can be viewed properly from its new location.  So far, so good.

However, this saves the downloaded file as "processcandquicksearch".  Instead, I
would like to save it as "mytest.html".  So, I use the -O option to specify a
name for the downloaded file...

wget -k \
-O mytest.html\
--post-data 'categories=NC000103&desctgl_state=full' \
http://158.careersite.com/candidate/processcandquicksearch

This does not work...

===========================
08:29:19 (37.73 KB/s) - `mytest.html' saved [30920/30920]

processcandquicksearch: No such file or directory
Converting processcandquicksearch... nothing to do.
Converted 1 files in 0.00 seconds.
===========================

It saves the output to "mytest.html" as requested by the -O option.  However,
when it goes to convert the links, as specified by the -k option, it looks for
the default output filename "processcandquicksearch" rather than the filename
that I specified with the -O option.

This seems to be a bug, though I can work around it with...

wget -k <blah blah blah>
mv <default filename> <my filename>

(Note:  I am using wget version 1.9.1)

Best regards,


Greg McCann

Reply via email to