Ubuntu – Renaming muliple files at once

command linerename

I have a bunch of wav files I converted to mp3 files using ffmpeg.

Now the mp3 files are all named file.wav.mp3.

How can I remove the .wav suffix while keeping the rest of the file name?
I would like to do this on a whole directory at once.

Best Answer

With a shell loop, removing the shortest "double dot suffix"

for f in *.wav.mp3; do echo mv "$f" "${f%.*.*}.mp3"; done

or (my personal favorite for things like this) with mmv from package mmv

mmv -n '*.wav.mp3' '#1.mp3'

Remove the echo or the -n as appropriate once you are happy that they are doing the right thing.