Last active
December 31, 2017 07:04
-
-
Save gentam/b0836fc582a8578d578277b859f3bae9 to your computer and use it in GitHub Desktop.
bulk extension name change
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
#!/usr/bin/env bash | |
if [ $# -ne 2 ]; then | |
echo "Usage: $(basename $0) oldExt newExt | |
e.g. $(basename $0) JPEG jpg" | |
exit 1 | |
fi | |
oldExt=$1 | |
newExt=$2 | |
for file in *.$oldExt; do | |
newName=${file%.$oldExt}.$newExt | |
mv -i "${file}" "${newName}" | |
echo $newName | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment