#!/usr/bin/perl -w recurse('c:'); #testing this on a windows machine sub recurse { my $dir = shift; #print $dir,$/; opendir(R,$dir) || die $!; my @dives = grep { $_ ne '.' && $_ ne '..' && -d $_ } readdir(R); #build a list all of the directories @dives = map { join('/',$dir,$_) } @dives; print "$_\n" for @dives; my @contra_band = ('avi','mp3','mp2','mpeg'); my @found; foreach my $a (@contra_band) { my @del = grep { $_ =~ /\Q$a\E$/ } readdir(R); #look for the file extensions map { push(@found,$_) } @del; #create an array of things to unlink later print @del; } map { recurse($_) } @dives; #couldn't think of a for loop to do the same thing... I don't know what is wrong with me today. }