Skip to main content
3 of 5
Anchor `oldExtension` to end of input file name
dhag
  • 16.3k
  • 4
  • 57
  • 66

Here's how I change all the file extensions in the current directory on Debian.

rename "s/oldExtension$/newExtension/" *.txt

(This is the Perl rename command, not the util-linux one. See Why is the rename utility on Debian/Ubuntu different than the one on other distributions, like CentOS?)

Matthias Braun
  • 8.8k
  • 8
  • 51
  • 63