#!/usr/bin/perl use MP3::Info; $dHandle = 'dh00'; my $startDir = shift || '.'; my $separator = shift || '\\'; parseDir($startDir); sub parseDir { my $currentDir = shift || return; my $dirHandle = $dHandle++; opendir($dirHandle, $currentDir) or die "Coudln't open directory $startDir.\n"; while (my $filename = readdir ($dirHandle)) { next if ($filename =~ /^\./); # go to next filename if we have a special file (i.e. . or ..) # if we find a directory, parse it by calling the parseDir again ( Recursion ). if( -d "$currentDir$separator$filename" ) { parseDir("$currentDir$separator$filename"); } elsif($filename =~ /mp3/i) { my $mp3 = new MP3::Info "$currentDir$separator$filename"; unless ($mp3 == undef) { print "$currentDir$separator$filename\n"; } } } closedir($dirHandle); } exit(0);