You can use id3ren
which is a ID3Tag file renamer. The application is in the repositories, so it can be easily installed. This should work as well with .m4a
files.
sudo apt-get install id3ren
To use it, go to the folder where your music is, preferably into an actual folder where you have music that you want renamed. Then you can rename using a template that is offered by id3ren
. Template options are as follows:
-template=TEMPLATE
Use TEMPLATE as the basis for renaming files. The default tem‐
plate used is '[%a]-[%s].mp3'. Identifiers that can be used in
the template are:
%a - Artist name
%c - Comment
%s - Song name
%t - Album title
%n - Track Number
%y - Year
%g - Genre
Using a directory from my system here that I know is named incorrectly we can see the files before running id3ren
on the files:
$ ls -l *.mp3
-rwxrwxrwx 1 root root 3851479 Jul 10 20:31 01 - Track 1.mp3
-rwxrwxrwx 1 root root 3726796 Jul 10 20:31 02 - Track 2.mp3
-rwxrwxrwx 1 root root 5001982 Jul 10 20:31 03 - Track 3.mp3
-rwxrwxrwx 1 root root 3111721 Jul 10 20:32 04 - Track 4.mp3
-rwxrwxrwx 1 root root 4680892 Jul 10 20:32 05 - Track 5.mp3
-rwxrwxrwx 1 root root 4504918 Jul 10 20:32 06 - Track 6.mp3
-rwxrwxrwx 1 root root 5135839 Jul 10 20:32 07 - Track 7.mp3
-rwxrwxrwx 1 root root 5397715 Jul 10 20:32 08 - Track 8.mp3
-rwxrwxrwx 1 root root 3229732 Jul 10 20:32 09 - Track 9.mp3
-rwxrwxrwx 1 root root 3760156 Jul 10 20:32 10 - Track 10.mp3
Now, running id3ren
on the folder with the template options for Track Number - Song Name.mp3
using all mp3
files (*.mp3)
in that folder:
$ id3ren -template='%n - %s.mp3' *.mp3
01 - Track 1.mp3 => 01 - Your Song.mp3
02 - Track 2.mp3 => 02 - Daniel.mp3
03 - Track 3.mp3 => 03 - Honky Cat.mp3
04 - Track 4.mp3 => 04 - Goodbye Yellow Brick Road.mp3
05 - Track 5.mp3 => 05 - Saturday Nights Alright.mp3
06 - Track 6.mp3 => 06 - Rocket Man.mp3
07 - Track 7.mp3 => 07 - Benny and the Jets.mp3
08 - Track 8.mp3 => 08 - Dont Let the Sun Go Down on Me.mp3
09 - Track 9.mp3 => 09 - Border Song.mp3
10 - Track 10.mp3 => 10 - Crocodile Rock.mp3
Processed: 10 Failed: 0 Total: 10
As we can see now, the folder has had the files renamed to match the ID3Tag contained in the .mp3
file itself:
$ ls -l *.mp3
-rwxrwxrwx 1 root root 3851479 Oct 24 15:39 01 - Your Song.mp3
-rwxrwxrwx 1 root root 3726796 Oct 24 15:39 02 - Daniel.mp3
-rwxrwxrwx 1 root root 5001982 Oct 24 15:39 03 - Honky Cat.mp3
-rwxrwxrwx 1 root root 3111721 Oct 24 15:39 04 - Goodbye Yellow Brick Road.mp3
-rwxrwxrwx 1 root root 4680892 Oct 24 15:39 05 - Saturday Nights Alright.mp3
-rwxrwxrwx 1 root root 4504918 Oct 24 15:39 06 - Rocket Man.mp3
-rwxrwxrwx 1 root root 5135839 Oct 24 15:39 07 - Benny and the Jets.mp3
-rwxrwxrwx 1 root root 5397715 Oct 24 15:39 08 - Dont Let the Sun Go Down on Me.mp3
-rwxrwxrwx 1 root root 3229732 Oct 24 15:39 09 - Border Song.mp3
-rwxrwxrwx 1 root root 3760156 Oct 24 15:39 10 - Crocodile Rock.mp3
EDIT: Also ran with Artist name for batch rename. This works as long as the Artist tag is correct in the ID3 tag:
This with [artist] - [track] - [name]
$ id3ren -template='%a - %n - %s.mp3' *.mp3
01 - Your Song.mp3 => Elton John - 01 - Your Song.mp3
02 - Daniel.mp3 => Elton John - 02 - Daniel.mp3
03 - Honky Cat.mp3 => Elton John - 03 - Honky Cat.mp3
04 - Goodbye Yellow Brick Road.mp3 => Elton John - 04 - Goodbye Yellow Brick Road.mp3
05 - Saturday Nights Alright.mp3 => Elton John - 05 - Saturday Nights Alright.mp3
06 - Rocket Man.mp3 => Elton John - 06 - Rocket Man.mp3
07 - Benny and the Jets.mp3 => Elton John - 07 - Benny and the Jets.mp3
08 - Dont Let the Sun Go Down on Me.mp3 => Elton John - 08 - Dont Let the Sun Go Down on Me.mp3
09 - Border Song.mp3 => Elton John - 09 - Border Song.mp3
10 - Crocodile Rock.mp3 => Elton John - 10 - Crocodile Rock.mp3
Processed: 10 Failed: 0 Total: 10
This with [track] - [artist] - [name]
$ id3ren -template='%n - %a - %s.mp3' *.mp3
Elton John - 01 - Your Song.mp3 => 01 - Elton John - Your Song.mp3
Elton John - 02 - Daniel.mp3 => 02 - Elton John - Daniel.mp3
Elton John - 03 - Honky Cat.mp3 => 03 - Elton John - Honky Cat.mp3
Elton John - 04 - Goodbye Yellow Brick Road.mp3 => 04 - Elton John - Goodbye Yellow Brick Road.mp3
Elton John - 05 - Saturday Nights Alright.mp3 => 05 - Elton John - Saturday Nights Alright.mp3
Elton John - 06 - Rocket Man.mp3 => 06 - Elton John - Rocket Man.mp3
Elton John - 07 - Benny and the Jets.mp3 => 07 - Elton John - Benny and the Jets.mp3
Elton John - 08 - Dont Let the Sun Go Down on Me.mp3 => 08 - Elton John - Dont Let the Sun Go Down on Me.mp3
Elton John - 09 - Border Song.mp3 => 09 - Elton John - Border Song.mp3
Elton John - 10 - Crocodile Rock.mp3 => 10 - Elton John - Crocodile Rock.mp3
Processed: 10 Failed: 0 Total: 10
Hope this helps!