#!/usr/bin/perl use warnings; use strict; use File::Find; use File::Spec; my $directory = shift @ARGV || '/mnt/music/very-good'; find (\&wanted, $directory); my %path_file; sub wanted { my $path = $File::Find::dir; my $filename = File::Spec->abs2rel($File::Find::name, $path); push @{$path_file{$filename}}, $path; } while (my ($filename, $paths) = each %path_file){ if (scalar @$paths >= 2){ print "$filename occurs in these paths: ", join(", ", @$paths), "\n"; } # else { # print "$filename is uniq\n"; # } }