On 19.02.23 02:23, Darshit Shah wrote:
On Fri, Feb 17, 2023, at 18:03, Tim Rühsen wrote:It is not possible to control the stored file names with multiple -O options (missing feature)Sorry, but no. This is not a missing feature. Its a long standing annoyance of mine but the manual describes -O as being equivalent to shell redirection. See the below selected quotes 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://foo is intended to work like wget -O - http://foo > file; file will be truncated immediately, and all downloaded content will be written there. ``` And ``` Similarly, using -r or -p with -O may not work as you expect: Wget won't just download the first file to file and then download the rest to their normal names: all downloaded content will be placed in file. ``` Since this is a long standing documented "feature" I am not keen on modifying the default behavior as automated scripts that rely on it my break. This was the reason that the first thing I did with Wget2 was to remove that sentence and implication from its manual allowing for a more intuitive implementation of the -O option there. However, unfortunately, this non-intuitive behavuour of -O shall stay in Wget for the time being.
Thanks for the clarification :) I think we are on the same page here.The "missing feature" was not meant to change the -O behavior, but more about having a feature that allows specifying names for multiple downloads. There are different ways to achieve that. E.g. one possible option could be to specify a well-formed CSV file with URL and file name as two columns. But it is easy to write such a tool either as a shell script or with the help of libwget (for the random reader: libwget is part of wget2).
Regards, Tim
OpenPGP_signature
Description: OpenPGP digital signature