chovy
chovy

Reputation: 75656

renaming a bunch of files in bash

I have a few files in linux:

_foo_1.php
_foo_2.php
_foo_3.php

I want to rename them all from _foo to _bar, preserving the rest of the filename.

I have tried this, but it doesn't rename anything:

rename 's/_foo/_bar/' *.php

Upvotes: 0

Views: 98

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798456

The syntax you're using is for Debian rename. Red Hat rename uses a completely different syntax.

rename _foo _bar _foo*.php

Upvotes: 3

Related Questions