我可以使用 wget 来检查,但不能下载吗 [英] Can I use wget to check , but not download
本文介绍了我可以使用 wget 来检查,但不能下载吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以使用 wget 来检查 404 而不是实际下载资源吗?如果是这样怎么办?谢谢
Can I use wget to check for a 404 and not actually download the resource? If so how? Thanks
推荐答案
有命令行参数 --spider
正是为此.在这种模式下,wget 不下载文件,如果找到资源,它的返回值为零,如果没有找到,则返回非零值.试试这个(在你最喜欢的 shell 中):
There is the command line parameter --spider
exactly for this. In this mode, wget does not download the files and its return value is zero if the resource was found and non-zero if it was not found. Try this (in your favorite shell):
wget -q --spider address
echo $?
或者,如果您想要完整输出,请关闭 -q
,因此只需 wget --spider address
.-nv
显示了一些输出,但没有默认值那么多.
Or if you want full output, leave the -q
off, so just wget --spider address
. -nv
shows some output, but not as much as the default.
这篇关于我可以使用 wget 来检查,但不能下载吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文