All~

Of late I decided to run through my mp3 collection and standardize the filenames. I figured that this would be a perfect candidate for a small script. I ran into a little trouble with Mp3::Tag not supporting some of the tag versions that I have. But after exploring CPAN for a little while, I got everything working using MP3::Info. Apologies to everyone for the very Windows specific `move ...`
use MP3::Info; opendir(DIR, ".") or die "can't opendir $some_dir: $!"; @files = grep { /mp3/ } readdir(DIR); closedir DIR; for (@files) { my $tag = get_mp3tag($_) or print "Could not access tag on $_\n" and next; my $newname = $tag->{"ARTIST"} . " - " . $tag->{"TITLE"} . ".mp3"; `move "$_" "$newname"`; }
Comments are most welcome,
Boots
---
Computer science is merely the post-Turing decline of formal systems theory.
--???

Replies are listed 'Best First'.
(jeffa) Re: Script to rename mp3s based on id3 tags
by jeffa (Bishop) on Jul 21, 2003 at 22:10 UTC
Re: Script to rename mp3s based on id3 tags
by barbie (Deacon) on Jul 21, 2003 at 23:54 UTC
    Also have a look at The Mad Hatter's latest script contribution "Intelligent" ID3v2 Tagger. It works in the opposite direction to your script, but it might give you a few ideas.

    --
    Barbie | Birmingham Perl Mongers | http://birmingham.pm.org/