superlzl 发表于 2016-11-26 13:44:22

Wget如何下载文件到指定的目录?

网上都说用-P命令,可是没用.

licess 发表于 2016-11-26 15:22:37

怎么不行的
# wget soft.vpser.net/lnmp/lnmp1.3.tar.gz -P /home/wwwroot/
--2016-11-26 14:42:59--http://soft.vpser.net/lnmp/lnmp1.3.tar.gz
Resolving soft.vpser.net (soft.vpser.net)... 2604:a880:1:20::5f9:4001, 50.93.201.152
Connecting to soft.vpser.net (soft.vpser.net)|2604:a880:1:20::5f9:4001|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 121700 (119K)
Saving to: ‘/home/wwwroot/lnmp1.3.tar.gz’

lnmp1.3.tar.gz                              100%[===========================================================================================>] 118.85K--.-KB/s    in 0.001s

2016-11-26 14:42:59 (95.6 MB/s) - ‘/home/wwwroot/lnmp1.3.tar.gz’ saved

superlzl 发表于 2016-11-26 21:00:16

回复 2# 的帖子

谢谢军哥,不好意思我没说清楚情况,我是下载指定文件里的网址到指定目录,这样就失效了
wget -i xxxxx.txt-P /home/wwwroot/
试了很多格式,只能下载到当前命令行所在目录。

[ 本帖最后由 superlzl 于 2016-11-26 21:02 编辑 ]

licess 发表于 2016-11-27 10:29:35

# wget -i a.txt -P /home/wwwroot/
--2016-11-27 10:15:34--http://soft.vpser.net/lib/curl/curl-7.51.0.tar.bz2
Resolving soft.vpser.net (soft.vpser.net)... 107.151.188.233
Connecting to soft.vpser.net (soft.vpser.net)|107.151.188.233|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2570046 (2.5M)
Saving to: '/home/wwwroot/curl-7.51.0.tar.bz2'

curl-7.51.0.tar.bz2                         100%[===========================================================================================>]   2.45M8.03MB/s    in 0.3s   

2016-11-27 10:15:35 (8.03 MB/s) - '/home/wwwroot/curl-7.51.0.tar.bz2' saved

--2016-11-27 10:15:35--http://soft.vpser.net/lib/curl/curl-7.47.1.tar.gz
Reusing existing connection to soft.vpser.net:80.
HTTP request sent, awaiting response... 200 OK
Length: 4567500 (4.4M)
Saving to: '/home/wwwroot/curl-7.47.1.tar.gz'

curl-7.47.1.tar.gz                        100%[===========================================================================================>]   4.36M9.40MB/s    in 0.5s   

2016-11-27 10:15:35 (9.40 MB/s) - '/home/wwwroot/curl-7.47.1.tar.gz' saved

--2016-11-27 10:15:35--http://soft.vpser.net/lib/curl/curl-7.42.1.tar.gz
Reusing existing connection to soft.vpser.net:80.
HTTP request sent, awaiting response... 200 OK
Length: 4291533 (4.1M)
Saving to: '/home/wwwroot/curl-7.42.1.tar.gz'

curl-7.42.1.tar.gz                        100%[===========================================================================================>]   4.09M8.99MB/s    in 0.5s   

2016-11-27 10:15:36 (8.99 MB/s) - '/home/wwwroot/curl-7.42.1.tar.gz' saved

FINISHED --2016-11-27 10:15:36--
Total wall clock time: 1.4s
Downloaded: 3 files, 11M in 1.2s (8.91 MB/s)
# cat a.txt
http://soft.vpser.net/lib/curl/curl-7.51.0.tar.bz2
http://soft.vpser.net/lib/curl/curl-7.47.1.tar.gz
http://soft.vpser.net/lib/curl/curl-7.42.1.tar.gz
命令参数都没问题,可能是你系统上的这个版本有bug,自己编译个wget试试
页: [1]
查看完整版本: Wget如何下载文件到指定的目录?