New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Comments
Here you go! This is a bash script which uses ping to check whether the host is reachable or not, you may adjust the values "files.txt" (input) and "deadlinks.txt" (output) as well:
Edit: added more code to stop if the file is no longer reachable during the loop (thanks to @Amitz)
Great so far, but what if the host is reachable, but the file is no longer existing?
curl return status can be handy here 200 ok otherwise to the bin
wget has some nice return codes: http://www.gnu.org/software/wget/manual/html_node/Exit-Status.html
Code 8 might be what you need, just use it in tiny shell script.
Is this bash only export broken links? How to also download and then export broken links.
BTW, many thanks for all helps!
Sorry I just re-read your main post and realized that you would like to validate whether the URL returns a valid image or not - I have modified the script to do the following:
Here you go:
For what it's worth, wget has a logging flag. You can just enable that, and parse out the 404s afterwards. That would save you from doing requests more than once.