Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a bunch of recovered mp3 files that have system generated filenames. I want to use any embedded ID3 tag info in the files to rename each one to something human readable.

I've tried 'mp3rename' from the debian apt repo but it doesn't handle mp3 files without id3 tagging automatically. Is there a workable alternative?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

id3v2 and some scripting should make this possible. I'll look through the man pages and try to write up an example, but id3v2 -l file will list the tags from that file. From there you can pipe through awk/sed/whatever to end up with a command to rename the file.

share|improve this answer

If you like Perl, an easy way to get a hold of the tags is this:

#!/usr/bin/env perl
use File::Find;
use MP3::Tag;
use Cwd;

$dir = ".";
open(OUTFILE,">tags.txt") || die "Can't open: $!\n";
print OUTFILE 'Output for "'.getcwd().'"'." and subdirectories\n";
print OUTFILE "Path;Artist;Title;Track;Album;Year;Genre;File Size\n";

find(\&edits, $dir);
print "Done\n";

sub edits() 
    if ( -f and $fn=~m/.+\.mp3$/ig)
        $mp3 = MP3::Tag->new($fn);
        ($title, $track, $artist, $album, $comment, $year, $genre) = $mp3->autoinfo();
        $fs= -s $fn;
        print OUTFILE "$File::Find::name\\$fn;$artist;$title;$track;$album;$year;$genre;$fs\n";
    if ( -f and $fn=~m/.+\.wav$|\.m4a$/ig)
        $fs= -s $fn;
        print OUTFILE "$File::Find::name\\$fn;;;;;;;$fs\n";

From there, a little scripting, and you've got what you want.

share|improve this answer

This is not command line, but EasyTag is what I have always used. It lets me add Cover and CD artwork to the files also.

share|improve this answer
Just mentioning the name of a tool isn't considered an answer. Please see… for guidance on recommending software. Thanks. –  fixer1234 Sep 26 at 0:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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