代码之家  ›  专栏  ›  技术社区  ›  ha22109

使用wget下载图像文件夹

  •  4
  • ha22109  · 技术社区  · 16 年前

    我需要在脚本中写一行,从abc.com/image/images/这样的URL下载一个目录(大约有10个图像),在脚本中尝试下面的wget命令:

    wget -e robots=off -r -l1 --no-parent -A.gif http://abc.com/Image/images/ 或 WGET—一个“*.GIF” http://abc.com/image/images/图片/

    but it is giving error as :

    HTTP request sent, awaiting response... 403禁止 11:25:12错误403:禁止。 删除abc.com/images/images/index.html,因为它应该被拒绝。 unlink: No such file or directory

    I am already using the wget command to download one file from the same URL and it is working fine but in case of directory it is failing.

    Can anyone help me quickly in this?

    3 回复  |  直到 16 年前
        1
  •  4
  •   ShinTakezou    16 年前

    for while (in bash or powershell or what you have) or similar; if the names follow a "pattern", consider using curl instead, with it you can do things like

    curl http://asdf.com/what/ever/image/img[00-99].gif -o img#1.gif
    

    to download images with names img00.gif, img01.gif and so on.

        2
  •  1
  •   Shade    16 年前

    我想您不能列出Web服务器上的目录。wget正在从它的Web列表中获取有关要下载目录内容的信息。如果不允许(403:禁止),则wget无法下载文件。当然,我可能错了

        3
  •  0
  •   SLaks    16 年前

    This is not possible.

    wget cannot know which files exist on the remote server.

    相反,如果服务器启用了目录浏览,或者图像链接到了某个地方,则可以对其他页面进行爬网。