Bulk rename from console


I have recently needed to rename a number of mp3 files, all starting with track numbers. The reason for this is for a program called amarok, which thinks the first set of numbers (track numbers) is the "artist" name so it would not list the songs correctly in the database. So I set out to cure the issue.

I found this to be simpler than using sed or rename and its easier to remember too.

This line of code: takes out the numbers 0-9 and "stops" after the first - (dash).

for name in *; do mv -v $name ${name#[0-9]*-}; done

Change the -(dash) to a space, dot, or what you need for your specific use.

This document was last modified on: 082521 04:40:58 UTC