wget不必要地下载index.html并停止批处理脚本(Windows)

时间:2015-09-22 16:14:10

标签: windows batch-file cmd wget

我在wget64上遇到Windows时遇到问题:

@echo OFF
FOR /L %%i in (1, 1, 9999) DO (
cls
echo Downloading file %%i
wget64.exe -e robots=off --progress=bar --show-progress -r -np -nd -nc -HDfilepi.com --content-disposition -a wget.log ebooks.info/book/%%i/
)

wget将下载index.html(我觉得这是不必要的),然后它会继续到托管文件并在目标文件不存在时下载它,但无法检索{下一本书的{1}}并开始下一次下载。

是否真的有必要下载index.html,如果是这种情况,我怎么能告诉index.html每次删除和下载新的?{/ p>

  

免责声明:我只是询问wget的具体行为,我   我不是要求帮助下载脚本,也不宽恕   非法下载文件。

1 个答案:

答案 0 :(得分:0)

我想你可能会过度思考这个问题。假设wget正在检索的所有其他文件都是正确的,因为无论如何你都在使用FOR循环,为什么不在每次迭代中删除index.html,如下所示:

@echo OFF
FOR /L %%i in (1, 1, 9999) DO (
cls
echo Downloading file %%i
wget64.exe -e robots=off --progress=bar --show-progress -r -np -nd -nc -HDfilepi.com --content-disposition -a wget.log ebooks.info/book/%%i/
if exist index.html del index.html
)