use strict; use warnings; use File::Find; my $path = "d://changma_ha"; find(\&checkFile, $path); exit 0; sub checkFile { my $fullfilename = $File::Find::name; # with the full path my $filename = $_; # just the filename if ($filename =~ /\.mp3$/ ) # name ends with .mp3 { print "Finally found $fullfilename\n"; } }