Skip to content

Instantly share code, notes, and snippets.

@rocktronica
Created May 14, 2014 02: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 rocktronica/5469d9e510d534d9b019 to your computer and use it in GitHub Desktop.
Save rocktronica/5469d9e510d534d9b019 to your computer and use it in GitHub Desktop.
# You'll need ImageMagick, bub.
for filename in *.jpg
do
start='Description: '
name=$(identify -verbose "$filename" \
| grep -oE "$start.*" \
| cut -c ${#start}- \
| sed -e 's/^[ \t]*//')
lowercase=$(echo $name | tr '[:upper:]' '[:lower:]')
hyphenated=${lowercase// /-}
echo "$filename -> $hyphenated.jpg"
mv "$filename" "$hyphenated.jpg"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment