logger -s -t $LOGTAG "starting downloading files in $list"
while read -r url filename; do
- if wget --cut-dirs=100 -np -e robots=off -O $outdir$filename $otherargs $url; then
+ destarg = ''
+ if [ -n "$filename" ]; then
+ $destarg = " -O $outdir$filename"
+
+ if output=$(wget --cut-dirs=100 -np -e robots=off -P $outdir$destarg $otherargs $url); then
sed -i "/$filename/d" $list
echo $filename
logger -s -t $LOGTAG "downloaded $filename"
else
- logger -s -t $LOGTAG "downloading of $filename from $url failed."
+ logger -s -t $LOGTAG "downloading of $filename from $url failed: $output"
fi
done < $list