wget -N -O should work if only retrieving one file
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
wget (Ubuntu) |
New
|
Wishlist
|
Unassigned |
Bug Description
Binary package hint: wget
From the man page:
Use of -O is not intended to mean simply "use the name file instead of the one in the URL;" rather, it is analogous to shell redirection: wget -O file http://
is intended to work like wget -O - http://
For this reason, -N (for timestamp-checking) is not supported in combination with -O: since file is always newly created, it will always have a very new timestamp.
A warning will be issued if this combination is used.
However, this does not make sense if you are only downloading one url (the simple sense), and want to specify the filename, such as if downloading a url like http://
tags: | added: manpage |
Changed in wget (Ubuntu): | |
importance: | Undecided → Wishlist |
Nonconventionally Creative wrote: foo foo > file; file will be truncated immediately, and all downloaded content will be written there. example. com?page= 1 to file page1.html.
> Public bug reported:
>
> Binary package hint: wget
>
>>From the man page:
> Use of -O is not intended to mean simply "use the name file instead of the one in the URL;" rather, it is analogous to shell redirection: wget -O file http://
> is intended to work like wget -O - http://
>
> For this reason, -N (for timestamp-checking) is not supported in combination with -O: since file is always newly created, it will always have a very new timestamp.
> A warning will be issued if this combination is used.
>
> However, this does not make sense if you are only downloading one url
> (the simple sense), and want to specify the filename, such as if
> downloading a url like http://
As far as I'm concerned, -O was somewhat mis-designed. Yet, it's far too
late to change, as many existing scripts may rely on such misfeatures.
The best we can do is consider adding better options to replace it,
rather than attempt to mess with existing functionality that works as
designed, but whose design may suffer shortcomings.
We (upstream) would like at some point to implement a fairly generic
mechanism to allow renaming files, not just a single file, but
programatically adjust every file name (perhaps via a short sed script,
etc). Doing so would not be difficult, but we have a laundry list of
more pressing things to achieve, so the reality is that it will not be
done soon (of course, if a distro such as Ubuntu chose to adopt an
appropriate patch, we would consider including it upstream as well).
This description in the manual was added because many, many people were
attempting to use -N with -O, and would become puzzled when it didn't
work according to usual expectations. -N / -O has always worked this
way, but it wasn't especially clear to people. For a short period, we
attempted to flat-out disable -N with -O, giving an error. Of course,
this mishandled cases where someone had set timestamping on by default
in their ~/.wgetrc, so we demoted it to a warning. However, we will most
likely not alter the fundamental behavior itself.