#!/usr/bin/perl # # Perl conversion program to read all mp3 # files in current directory, replace spaces # and ' with _ in the names and convert to wav # format for burning to CD. # # ex. "file one.mp3" ==> file_one.wav # ex. "file's.mp3" ==> file_s.wav # # Written by Jeff Borders # Version 0.2 - April 15, 2006 # - Take out spaces and apostrophes # - and replace with underbar. # Version 0.1 - April 1, 2006 # use strict; use warnings; $|=1; opendir (DIR, '.') or die "Couldn't open directory, $!"; foreach (grep(/^.*\.mp3$/,readdir(DIR))) { print "Found MP3 named ==> $_\n"; my $file = $_; ### take out spaces and apostrophes ### ### and replace with underbar. ### if ($file =~ tr/' /_/sd) { print "File renamed to ==> $file\n"; rename($_,$file) or die "Couldn't rename $_"; } my ($name,$extension)=split(/\./,$file); system("mpg321 --wav $name.wav $file"); print "Converting to wav complete\n"; } closedir DIR;