When you want to rename a directory full of files from fooo2 to foo2, you’re first thought is using sed.. why, when
rename is easier?
First things first.. there’s different syntax if you’re using Ubuntu based and Red Hat / CentOS.. so pay attention.
We have a directory full of these files:
Whoever created these misspelled foo.. so we need to fix it so they’re all foo?.txt instead.
ie: from fooo1.txt to foo1.txt
We’re going to use
rename to accomplish this.
In Red Hat / CentOS, use this syntax.
rename fooo foo fooo*
In Ubuntu, use this syntax.
rename s/fooo/foo/ fooo*
If you did it right, you now have:
(and the boss is happy!)