#!/usr/bin/perl # mp3clean: make an iTunes music collection more Internet friendly. # Micah Valine 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 = ; 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, $_); }