Created
July 16, 2012 23:26
-
-
Save digitaljhelms/3125794 to your computer and use it in GitHub Desktop.
Bash CLI function to change the file extension for multiple files at once
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
# bash function, usage: $ ext [ext1] [ext2] | |
function ext() { | |
for f in *.$1; do mv $f `basename $f .$1`.$2; done; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With this this helper function you can change the file extension for multiple files at once by simply typing
ext foo bar
; this would rename all files in the current directory with the extension.foo
to the extension.bar
.