$ rename -v "\$_=lc;s/&/ and /g;y/()'/--/sd;s/(?:(\.)|(-)|[\W_])+/\$1||\$2||'_'/ge" *
####
$_=lc;s/&/ and /g;y/()'/--/sd;s/(?:(\.)|(-)|[\W_])+/$1||$2||'_'/ge;
####
my @f = (
'Godspeed - Sunshine and Gasoline.mp3',
'Pogues - Token Celtic Drinking Song.mp3',
'The Pogues - Beer, Beer, Beer (Irish drinking song).mp3',
'Hell\'s Ditch',
'One&Two.mp3',
'A!! ...--B._._.C_-___-_D-._.-E',
);
for (@f) {
print;
$_=lc;s/&/ and /g;y/()'/--/sd;
print;
s/(?:(\.)|(-)|[\W_])+/$1||$2||'_'/ge;
print;
}
####
#!/usr/bin/env perl
# I couldn't work out how to escape this for a shell alias
my $cmd = join '', split /\n/, <<'CMDS';
$_=lc;s/&/ and /g;
y/()'/--/sd;
s/(?:(\.)|(-)|[\W_])+/$1||$2||'_'/ge;
s/^[._-]//; s/[._-]$//;
CMDS
system('rename','-v',$cmd, @ARGV);