#!/usr/bin/perl @dirs = $ENV{'PWD'}; if ($ARGV[0] eq "-r") { while ($dir = pop(@dirs)) { opendir(DIR, "$dir"); readdir(DIR); readdir(DIR); while ($file = readdir(DIR)) { $path = $dir."/".$file; if (-d $path) { push(@dirs, $path); $dir_count++; } else { if (substr($path, -4, 4) eq ".wma") { $new_path = substr($path, 0, -3)."mp3"; system("mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader \"$path\" && lame -m s audiodump.wav -o \"$new_path\" && rm audiodump.wav"); system("rm \"$path\"") if (-f "$path"); $file_count++; } } } close(DIR); } system("rm audiodump.wav"); print "Counverted:\n"; print "\tDirectories: $dir_count\n"; print "\tFiles: $file_count\n"; }