2014-12-23 16 views
1

我知道-i标志需要一个文件(可能包含URL列表),我知道可以指定-o后跟一个名称来重命名使用wget下载的项目。如何在wget中使用-o标志与-i?

例如:

wget -i list_of_urls.txt

wget -o my_custom_name.mp3 http://example.com/some_file.mp3

我有一个看起来像这样的文件:

文件名:list_of_urls.txt

http://example.com/some_file.mp3 http://example.com/another_file.mp3 http://example.com/yet_another_file.mp3

我想使用wget来下载这些文件与-i标志也保存每个文件1.MP3,2.MP3等。

可以这样做吗?

回答

0

我又跑了网络搜索,发现https://superuser.com/questions/336669/downloading-multiple-files-and-specifying-output-filenames-with-wget

的Wget似乎无法做到这一点,但卷曲可以-K标志,提供的文件可以包含URL和输出的名字。请参阅http://curl.haxx.se/docs/manpage.html#-K

如果您愿意使用某些shell脚本,那么https://unix.stackexchange.com/questions/61132/how-do-i-use-wget-with-a-list-of-urls-and-their-corresponding-output-files有答案。

0

您可以使用任何脚本语言(PHP或Python)来生成批处理文件。在瘦批处理文件中,每行将包含运行带有url和-O选项的wget。

或者你可以尝试在bash脚本中写入循环。