use strict ; use warnings ; my $path = '\\\\sephiroth\\pub\\music\\sdb\\ginsu gnives\\' ; my $playlist = '.\\playlist' ; opendir (my $DIR, $path) || die "opendir (\"$path\"): $!\n" ; my %files = map {(lc $_, "$path$_")} grep {/\.mp3$/i && !-d "$path$_"} readdir $DIR ; closedir ($DIR) ; open (my $PLAYLIST, "<$playlist") || die "open (\"$playlist\"): $!\n" ; my %playlist = map {y/\r\n//d; (lc $_, 1)} <$PLAYLIST> ; close ($PLAYLIST) ; print join ("\n\t", "\%files =", map {"$_ => $files{$_}"} keys %files), "\n" ; print join ("\n\t", "\%playlist =", keys %playlist), "\n" ; my %remove ; for (keys %files) { $remove{$_} = 1 unless $playlist{$_} ; } print join ("\n\t", "\%remove =", keys %remove), "\n\n" ; print "unlink $files{$_}\n" for keys %remove ; #unlink $files{$_} for keys %remove ;