otherargs=$@ # set aside remaining arguments for passing to wget
while read -r url filename tail; do
- wget --cut-dirs=100 -r -np -nc --accept -e robots=off -O "$outdir$filename" "$url" $otherargs
+ if wget --cut-dirs=100 -r -np -nc --accept -e robots=off -O "$outdir$filename" "$url" $otherargs
+ sed '/$filename/d' $list
+ fi
done < $list