Ubuntu – way to quickly change all the file extensions of all files in a folder

command linefile formatnautilus

I have a large folder of .m4b audio books which in their current format won't play on my Android phone. However they do work fine if they are renamed to .m4a

Is there a quick method or terminal command that can rename every .m4b file in a folder to .m4a? There is no need for any conversion of the files, simply renaming the file extension works perfectly fine.

Best Answer

This will do the job for you.

rename 's/.m4b$/.m4a/' *.m4b

For a test run you can use this command:

rename 's/.m4b$/.m4a/' *.m4b -vn

-v means "verbose" and it will output the names of the files when it renames them.

-n will do a test run where it won't rename any files, But will show you a list of files that would be renamed.