Created
January 11, 2017 06:49
-
-
Save jdevoo/6a81b86a3c1f713cd70b8e8a0c6c8ed1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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