Wget 和递归下载

Wget 和递归下载

启用目录列表的文件夹有 2 个 zip 文件。我试图只下载其中一个(最新的)。问题是 zip 文件名是一个随机字符串。

我目前拥有的命令是

wget -r -nH --cut-dirs=3 --no-parent --accept=zip http://192.168.1.21/files/$name/?C=M;O=A

这似乎会下载所有 zip 文件。我希望下载 wget 找到的第一个文件。有什么办法吗?

答案1

如果 zip 文件的大小明显大于其余数据,您可以设置--quota=max size of the smallest zipfile,请注意,wget如果超出配额,不会停止下载尽管下载文件:

   -Q quota
   --quota=quota
       Specify download quota for automatic
       retrievals.  The value can be specified in
       bytes (default), kilobytes (with k suffix),
       or megabytes (with m suffix).

       Note that quota will never affect downloading
       a single file.  So if you specify wget -Q10k
       ftp://wuarchive.wustl.edu/ls-lR.gz, all of
       the ls-lR.gz will be downloaded.  The same
       goes even when several URLs are specified on
       the command-line.  However, quota is
       respected when retrieving either recursively,
       or from an input file.  Thus you may safely
       type wget -Q2m -i sites---download will be
       aborted when the quota is exceeded.

       Setting quota to 0 or to inf unlimits the
       download quota.

相关内容