#!/usr/bin/perl
print "Enter the
where the mp3's are found: ";
chomp ($dir = );
chdir($dir) or die "Canot change $dir :$!\n";
opendir(DIR, $dir) or die "Cannot open $dir:$!\n";
@songs = readdir(DIR);
closedir(DIR);
@songs=grep(/(.mp3)|(.MP3)|(.mP3)|(.Mp3)/,@songs);
foreach(@songs)
{
if($_ =~ m/^(.*)\s*-\s*(.*).mp3/i)
{
my $end = $2;
my $start = $1;
$start =~ s/\s*$//;
s/{|}//g for ($start, $end);
rename $_,"$start - $end.mp3";
print "$start - $end.mp3\n";
}
}