Wildewinds @ Sat Jun 28, 2008 1:33 am wrote:
I'm a home user and I'm trying to organize my mp3/cdg files. I need to do a few things like swapping the artist with the song title and getting rid of the disc ID (which I still don't understand why I would want that).
Because you can have more than one copy of a song? And there can be more than one version by a manufacturer? (I have two CB "One Night At A Time", both different. There are multiple versions of quite a few songs floating around.)
Quote:
I found KJ File Manager and it works well enough, but the licensing fee of $79 seemed a bit steep.
Any other options? Anything better than manually renaming each file would work for me.
Oh yeah, free is good.
I wrote my own Perl script that does it. I would post it here, but it really isn't designed for anyone not heavily into Perl to use. It does some cool things, though -- regularizes artist and song names, puts songs in a database table, etc.
Here is a short Perl script, though, which is probably more usable and which will do it. It calls the well-known Perl rename script:
Code:
#!/usr/bin/perl
use Getopt::Std;
my %opt;
getopts('v', \%opt);
# Usage: rename perlexpr [files]
($op = shift) || die "Usage: rename perlexpr [filenames]\n";
if (!@ARGV) {
@ARGV = <STDIN>;
chop(@ARGV);
}
for (@ARGV) {
$was = $_;
eval $op;
die $@ if $@;
warn "rename '$was' -> '$_'\n" if $opt{v};
rename($was,$_) unless $was eq $_;
}
Save that to a file called rename.pl. Then from the DOS (or UNIX) command line:
perl rename.pl 's/^\w+-\d+\s+-\s+(.*?)\s+-\s+(.*)\.(\w+)$/$2 - $1.$3/' *.mp3
That will swap the artist and title and strip the disk ID from a classic file naming style:
SC8493-05 - Strait, George - Amarillo By Morning.zip
and turn that into:
Amarillo By Morning - Strait, George.zip
Perhaps better yet, this one retains the disk type:
perl rename.pl 's/^([A-Z]+)\d+-\d+\s+-\s+(.*?)\s+-\s+(.*)\.(\w+)$/$3 - $2 ($1).$4/' *.mp3And makes it:
Amarillo By Morning - Strait, George (SC).zip
It's free! Except for the study and training that makes it readable...