fractal5
fractal5

Reputation: 2132

Find and replace string in folder name using command line

How can I replace a string in all my folder names in one directory. For example if I have these folders

hellojoe hellomary hellosusan

I want to change these to

worldjoe worldmary worldsusan

Upvotes: 1

Views: 1364

Answers (1)

fractal5
fractal5

Reputation: 2132

Using this command works

find . -name 'hello*' -exec bash -c 'mv "$1" "${1/hello/world}"' -- {} \;

Upvotes: 2

Related Questions