This seems to be becoming a recurrent theme around these parts - but recursive file search stuff like this is a lot easier with File::Find. You'd do it something like this (untested code):
use strict;
use File::Find;
if ($ARGV[0]) {
find(\&wanted, $ARGV[0]);
} else {
print "mp3playlist.pl by Viking (& davorg)\n";
print "usage: mp3playlist.pl <dir>\n";
}
sub wanted {
return unless -f;
return unless /\.mp3$/;
print "$File::Find::name\n";
}
--
<http://www.dave.org.uk>
European Perl Conference - Sept 22/24 2000, ICA, London
<http://www.yapc.org/Europe/> |