hem*_*uli 16 command-line wget
我正在尝试下载文件夹中的所有图像文件。我试过
wget -r https://example.com/
Run Code Online (Sandbox Code Playgroud)
和
wget https://example.com/*.jpg
Run Code Online (Sandbox Code Playgroud)
这些都没用。有人可以指导吗?
pl_*_*ock 19
如果目标 Web 服务器启用了目录索引,并且所有要下载的文件都位于同一目录中,则可以使用 wget 的递归检索选项下载所有文件。
用
wget -r -l1 -A.jpg http://www.example.com/test/
Run Code Online (Sandbox Code Playgroud)
它将.jpg从目录下载所有文件test。
如果您不想下载所有文件,那么下面的信息会有所帮助。
-A acclist --accept acclist
-R rejlist --reject rejlist
Specify comma-separated lists of file name suffixes or patterns to
accept or reject. Note that if any of the wildcard characters, *, ?,
[ or ], appear in an element of acclist or rejlist, it will be
treated as a pattern, rather than a suffix.
--accept-regex urlregex
--reject-regex urlregex
Specify a regular expression to accept or reject the complete URL.
Run Code Online (Sandbox Code Playgroud)
喜欢 :
wget -r --no-parent -A '*.jpg' http://example.com/test/
Run Code Online (Sandbox Code Playgroud)
用这个:
wget -r --level=1 -A.jpg --ignore-length -x -np http://example.com/folder/
Run Code Online (Sandbox Code Playgroud)
这有什么作用?
-r:递归检索(重要)
--level=0:指定递归最大深度级别。1 仅用于此目录。
-x:强制目录,即使不会创建目录,也创建目录层次结构
-np:没有父目录,递归检索时不要上升到父目录
-A.type:仅下载扩展名为type.
我的代词是他/他