Last active
December 27, 2015 17:49
-
-
Save jasondmoss/7365601 to your computer and use it in GitHub Desktop.
Bash: Rename the extensions of a group of files in a directory.
This file contains hidden or 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
### | |
## Rename file extensions | |
## | |
## EG. renameExt old new | |
### | |
function renameExt() { | |
for file in *.$1 | |
do | |
mv -- "$file" "$(expr "$file" : '\(.*\)\.'$1).$2" | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment