Skip to content

Instantly share code, notes, and snippets.

@sugayaa
Created September 6, 2020 16:02
Show Gist options
  • Save sugayaa/8d2cb55b05d5024370afce1cffeedfa1 to your computer and use it in GitHub Desktop.
Save sugayaa/8d2cb55b05d5024370afce1cffeedfa1 to your computer and use it in GitHub Desktop.
made for appending image's dimensions to it's filename
#!/bin/bash
FILES=$(find -type f -exec basename {} \;)
for file in $FILES; do
dimensions=$(identify $file | awk '{print $3}')
name=$(echo $file | tr "." " " | awk '{print $1}')
extension=$(echo $file | tr "." " " | awk '{print $2}')
mv $file $name-$dimensions.$extension
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment