wget下载URL列表并设置不同的文件路径 [英] Wget download list of URL and set different file paths

查看:25
本文介绍了wget下载URL列表并设置不同的文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里阅读http://www.thegeekstuff.com/2009/09/the-ultimate-wget-download-guide-with-15-awesome-examples/ 如果我想下载多个 URL,我可以将它们保存在像这样的文本文件

I read here http://www.thegeekstuff.com/2009/09/the-ultimate-wget-download-guide-with-15-awesome-examples/ that if I want to download multiple URL's, I can save them in a text file like this

$ cat > download-file-list.txt
URL1
URL2
URL3
URL4

像这样使用 wget

And use wget like this

$ wget -i download-file-list.txt

但是,假设我希望每个 URL 都保存在我驱动器上它自己的目录中,如下所示:

However suppose I want each URL to be saved in it's own directory on my drive, like this:

URL1 -> Users/Downloads/Tech
URL2 -> Users/Downloads/Fashion
URL3 -> Users/Downloads/Cooking
URL4 -> Users/Downloads/News

我如何做到这一点?是否可以为文本文件中的每个 URL 手动设置目录并让 wget 读取并自动知道每个文件的保存位置?有没有其他方法可以实现我所需要的?我稍后会尝试使用 cronjobs 设置和自动下载过程.

How do I accomplish this? Is it possible to manually set the directory for each URL in the text file and have wget read that and automatically know where to save each file? Is there any other methods to achieve what I need? I'm trying to setup and automated downloaded process using cronjobs later on.

谢谢

推荐答案

那你就不能用那个方法了.最好的方法是使用 bash、perl 或 python 脚本,它以某种格式(可能是URL 目录")读入文件并将每个 url 下载到指定目录.但是您需要在 wget 之外添加一些智能才能获得这种行为.

Then you can't use that method. The best way then would be a bash, perl, or python script that reads in a file in some format (maybe "URL directory") and downloads each url to the specified directory. But you'll need to put some smarts outside of wget to get that behavior.

这篇关于wget下载URL列表并设置不同的文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆