#!/bin/sh # Props to https://www.commandlinefu.com/commands/view/8234/check-broken-links-using-wget-as-a-spider set -eu if test "$#" -lt 1; then echo >&2 "Usage: $0 " exit 1 fi logfile="$(pwd)/wget.log.$(date +%FT%T)" tmp=$(mktemp --directory) cd "$tmp" wget --spider -o "$logfile" -r -p -X '/soustredeni/*/fotogalerie/' "$@" echo "Result: (a last few lines of the file $logfile)" sed -ne '/^Found [0-9]* broken links/,$ p' "$logfile"