I have around 600 mp3 song files in a folder. All the tracks have a number before their names. I want to remove the track-number from all the files. Ya I know I can rename those files and delete the numbers manually. But by changing all the files one by one will take so much of time. I want to know is there any other method which can remove the track number at a time? For your information I am using Ubuntu 12.04.So kindly help me. Any suggestions and help will be really appreciable. Thanks

  • Are all the numbers equally long or separated by a dash? (e.g. all MP3 are 01-songname.mp3. That would allow filtering on the dash, e.g. via cut -d'-' -f2-. That could be combined with a for song in *.mp3 l do something with mv and with cut ; done – Hennes Apr 10 '13 at 9:18

The easiest way to do this is with rename on the command-line. For example:

rename 's/^\d\d //' ./*.mp3

...this will turn a file called 01 trackname.mp3 into trackname.mp3, and will work on all *.mp3s in the working directory.

\d is perlexpr for [0-9], and ^ means 'the beginning of the string' (so it won't get rid of any numbers within the trackname). You can shange /^\d\d / to match any pattern you want - if you want to get rid of a -, you can do that.

Alternatively, you can use just bash:

for f in ./*.mp3; do mv "$f" "${f#[0-9][0-9] }"; done

If you have your files in multiple directories, then you'll need to use find. Let's say that you want to rename every *.mp3 in ~/Music and all subdirectories:

find ~/Music -type f -name '*.mp3' -exec rename 's/^\d\d //' {} \;
##  or
find ~/Music -type f -name '*.mp3' -exec bash -c 'mv "$0" "${0#[0-9][0-9] }"' {} \;
  1. Install EasyTAG from the default Ubuntu repositories.
  2. Open EasyTAG and browse to the directory that contains all your music files.
  3. Select all your mp3 song files. They will all be listed in the middle pane, including the song files that are in sub-directories.
  4. Click on the "Scan File(s)" button in the menu bar that has an icon with a picture of a light-green and white page.
  5. In the "Scanner" option select "Rename File and Directory".
  6. In the input field titled "Rename File and Directory" type %t.
  7. Click on the "Save File(s)" button. It has an icon with a picture of a hard drive with a green arrow on it. Confirm that you want the rename operation to apply to all of the selected files.

That's all there is to it. You just renamed all 600 files. This doesn't change the metadata tags, only the file names.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.