Skip to main content
Highlighted the distros to make it a little more clear upfront that this isn't a universal solution.
Source Link

Here's how I change all the file extensions in the current directory on DebianDebian or Ubuntu.

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?)

On MacOS, user Monkpit reports that they were able to use brew install rename to get this to work.

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?)

On MacOS, user Monkpit reports that they were able to use brew install rename to get this to work.

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

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?)

On MacOS, user Monkpit reports that they were able to use brew install rename to get this to work.

incorporate commented improvements
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 264

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?)

On MacOS, user Monkpit reports that they were able to use brew install rename to get this to work.

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?)

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?)

On MacOS, user Monkpit reports that they were able to use brew install rename to get this to work.

Anchor `oldExtension` to end of input file name
Source Link
dhag
  • 16.3k
  • 4
  • 57
  • 66

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

rename "s/oldExtensionoldExtension$/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?)

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?)

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?)

added 117 characters in body
Source Link
ilkkachu
  • 147.9k
  • 16
  • 268
  • 441
Loading
Source Link
Matthias Braun
  • 8.8k
  • 8
  • 51
  • 63
Loading