my $foldername; my $subdirlevel= shift // 2 ; my @files = File::Find::Rule->file() ->name('music.xml') ->maxdepth($subdirlevel) ->in( $foldername); print Dumper (@files); this give me the path where the music.xml is but not the directory name.