Created
March 14, 2013 00:08
-
-
Save ttscoff/5157697 to your computer and use it in GitHub Desktop.
One-line Bash command to change the extensions of all 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
# batch change extension | |
chgext() { | |
for file in *.$1 ; do mv $file `echo $file | sed "s/\(.*\.\)$1/\1$2/"` ; done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment