Skip to content

Instantly share code, notes, and snippets.

@jdevoo
Created January 11, 2017 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdevoo/6a81b86a3c1f713cd70b8e8a0c6c8ed1 to your computer and use it in GitHub Desktop.
Save jdevoo/6a81b86a3c1f713cd70b8e8a0c6c8ed1 to your computer and use it in GitHub Desktop.
#!/bin/bash
cat list | while read -r file url; do
post=$(basename "$file")
image=$(basename "$url")
outfile="${post%.*}.${image##*.}"
if [ -f ${outfile} ] ; then
count=$( find . -name "${post%.*}*" 2> /dev/null | wc -l )
outfile="${post%.*}-${count}.${image##*.}"
fi
wget ${url} -O ${outfile}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment