题
我需要下载到/ tmp / cron_test /文件。我的wget代码是
wget --random-wait -r -p -nd -e robots=off -A".pdf" -U mozilla http://math.stanford.edu/undergrad/
那么,有一些参数来指定目录?
解决方案
从手册页:
-P prefix
--directory-prefix=prefix
Set directory prefix to prefix. The directory prefix is the
directory where all other files and sub-directories will be
saved to, i.e. the top of the retrieval tree. The default
is . (the current directory).
所以,你需要-P /tmp/cron_test/
(短格式)或--directory-prefix=/tmp/cron_test/
(长格式)添加到您的命令。还要注意的是,如果该目录不存在,它会被创建。
其他提示
-O是指定要下载的文件的路径选择。
wget <file.ext> -O /path/to/folder/file.ext
-P是前缀表示,其中,将下载的文件在目录
wget <file.ext> -P /path/to/folder
请确保您有正确的网址为任何你正在下载。首先,与像?
和这样的字符的URL不能被解析和解决。这将混淆CMD线和接受都没有解决到源URL名称为您下载到文件名中的任何字符。
例如:
wget "sourceforge.net/projects/ebosse/files/latest/download?source=typ_redirect"
将下载到一个命名的文件,?source=typ_redirect
。
正如你所看到的,知道一两件事有关的URL有助于理解wget
。
我从hirens磁盘引导和只有Linux的2.6.1作为资源(进口OS不可用)。这解决了我的问题下载的ISO到物理硬盘驱动器的正确语法是:
wget "(source url)" -O (directory where HD was mounted)/isofile.iso"
人们可以通过寻找在什么时候wget
下载到一个文件名为index.html
(默认文件)计算正确的URL,并且有你需要通过以下命令显示文件的正确大小/其他属性:
wget "(source url)"
在该URL和源文件是正确的,它被下载到index.html
,可以停止下载( CTRL + ž),并通过使用改变输出文件:
-O "<specified download directory>/filename.extension"
源URL之后。
在我的情况下,这将导致下载一个ISO并存储它作为下一个isofile.iso
二进制文件,希望安装。
人的wget: -O文件 --output文档=文件
wget "url" -O /tmp/cron_test/<file>
尝试这种方法 -
import os
path = raw_input("enter the url:")
fold = raw_input("enter the folder:")
os.system('wget -r -nd -l1 -P %s --no-parent -A mp3 %s'%(fold, path))
不隶属于 StackOverflow