Skip to content

Instantly share code, notes, and snippets.

@ttscoff
Created March 14, 2013 00:08
Show Gist options
  • Save ttscoff/5157697 to your computer and use it in GitHub Desktop.
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
# 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