I use iTunes running on Mac OS X to create and manage my mp3 collection. It's a great piece of software, but it unfortunately doesn't give the user any control over the format of the filenames and directories it outputs. They consequently contain not only annoying characters like spaces, pound signs and parentheses, but also dangerous characters like ampersands, commas and apostrophes. I use this script to make my music directory a little more Internet friendly.
#!/usr/bin/perl
# mp3clean: make an iTunes music collection more Internet friendly.
# Micah Valine <micah@micahvaline.com>
use strict;
use File::Find;
die "Usage: mp3clean [Music Root Directory]\n" unless @ARGV == 1;
my $start_directory = $ARGV[0];
print "\nmp3clean is designed to make an iTunes music collection more
+Internet friendly\n";
print "by renaming files and directories in a more appropriate manner.
+ Running it on a directory\n";
print "other than a directory of mp3's may cause permanent damage.\n\n
+";
print "Press Enter to run mp3clean on [$start_directory]. ";
my $user_response = <STDIN>;
finddepth(\&cleanup, $start_directory);
print "\nmp3clean complete!\n";
sub cleanup() {
# get rid of these annoying files while we're at it
if ($_ eq ".DS_Store") { unlink $_; }
if ($_ eq ".FBCIndex") { unlink $_; }
if ($_ eq ".FBCSemaphoreFile") { unlink $_; }
if ($_ eq ".FBCLockFolder") { rmdir $_; }
my $original_filename = $_;
s/\'//g;
s/\,//g;
s/\#//g;
s/&/and/g;
s/!//g;
s/\(//g;
s/\)//g;
s/ /_/g;
$_ = lc($_);
rename($original_filename, $_);
}