简体   繁体   English

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

[英]wget downloads index.html unnecessarily and halts batch script (Windows)

I am having trouble with wget64 on Windows : 我在Windows上使用wget64遇到麻烦:

@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 will download index.html (which I feel is unnecessary), then it proceeds to the hosted file and downloads it if the file does not exist on the destination, but will fail to retrieve the index.html of the next book and start the next download. wget将下载index.html (我认为这是不必要的),然后继续进入托管文件并下载该文件(如果该文件在目标位置不存在),但将无法检索下一本书的index.html并启动该文件。下次下载。

Is it really necessary to download index.html and if that is the case, how can I tell wget to erase and download the new one every time? 是否真的需要下载index.html ,如果是这种情况,我如何告诉wget每次删除并下载新文件?

Disclaimer: I am only asking about the specific behaviour of wget, I am not asking to help in the download script nor do I condone illegally downloading files. 免责声明:我只是在问wget的特定行为,我不是在寻求帮助帮助下载脚本,也不是在纵容非法下载文件。

I think you may be overthinking this. 我认为您可能对此事有所思考。 Assuming that all the other files wget is retrieving are the correct ones, since you're using a FOR loop anyway, why not just delete index.html on each iteration like so: 假设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
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM