I made this really just for my use, but you may find it usefull. And so you know it have my Mp3s in /mp3s/_(BANDNAME) so that they all show up together then i do a ln -s _*/* . and mpg123 *. Anyway here is the code to make my mp3s look nice:
#!/usr/bin/perl -w #Rename's files to remove spaces and other shitz @names = qx {ls}; $a = qx {pwd}; @band = split(/\//, $a); $band[2] =~ s/\_//; chomp $band[2]; print "$band[2]\n"; foreach $file (@names) { chomp $file; $new = $file; $new =~ s/\.mp3//; $new =~ s/\W//g; $new =~ s/\_//g; $new =~ s/$band[2]//gi; if ( $file !~ "$band[2]\_$new\.mp3") { print "\tRenaming $file to $band[2]\_$new.mp3\n"; qx {mv \"$file\" "$band[2]\_$new\.mp3"}; } else { print "\tNo Change for $file\n"; } }
There probabley is a better way, if you know one please email zgornz at yahoo.com, i'm still learning perl and i would like any feedback.

Replies are listed 'Best First'.
RE: Mp3Mat
by Anonymous Monk on Jun 09, 2000 at 07:36 UTC
    Sorry, didn't think i needed the br's
    #!/usr/bin/perl -w #Rename's files to remove spaces and other shitz @names = qx {ls}; $a = qx {pwd}; @band = split(/\//, $a); $band[2] =~ s/\_//; chomp $band[2]; print "$band[2]\n"; foreach $file (@names) { chomp $file; $new = $file; $new =~ s/\.mp3//; $new =~ s/\W//g; $new =~ s/\_//g; $new =~ s/$band[2]//gi; if ( $file !~ "$band[2]\_$new\.mp3") { print "\tRenaming $file to $band[2]\_$new.mp3\n"; qx {mv \"$file\" "$band[2]\_$new\.mp3"}; } else { print "\tNo Change for $file\n"; } }

    20071014 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips