Created
June 30, 2018 05:31
-
-
Save thetutlage/a9bb6448eb0ce08163e49ed243b30124 to your computer and use it in GitHub Desktop.
Rename file extensions from a shell script
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
function rext () { | |
if [ $# -lt 3 ]; then | |
echo 1>&2 "$0 needs 3 arguments as DIR SOURCE_EXT DEST_EXT" | |
else | |
for file in "$1"/*.$2; do | |
mv "$file" "${file%.$2}.$3" | |
done | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment