Skip to content

Instantly share code, notes, and snippets.

@anscii
Created August 9, 2013 12:15
Show Gist options
  • Save anscii/6193160 to your computer and use it in GitHub Desktop.
Save anscii/6193160 to your computer and use it in GitHub Desktop.
#!/bin/bash
find . -type f -printf '%p\n' | while read file; do
oldfile=$(basename "$file")
newfile=$(echo "$oldfile" | sed 's/OLDNAME.jpg/NEWNAME.jpg/g')
if [ ! "$newfile" == "$oldfile" ]; then
mv "$file" "${file%$oldfile}$newfile"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment