Alex
Alex

Reputation: 357

Removing part of filename with bash

Why this script does not work?

for filename in bre*; do 
    rename 's/bre//'; 
done

I have files starting with bre in the directory and I would like to delete this part from filenames. It is running and nothing will happen and it is not finished. Thank you

Upvotes: 2

Views: 119

Answers (1)

Barmar
Barmar

Reputation: 781706

You didn't tell rename what files it should rename.

You don't need the loop, since you can use a wildcard for the filename arguments to rename

rename 's/bre//' bre*

Upvotes: 5

Related Questions