in reply to Duplicate Directory Names

Are you sure they're duplicates?
Unless I'm very much mistaken, (certainly on UNIX) you cannot have files/directories/special files with the same name in a given directory.

Update:
Doh! Across an entire directory tree it's possible (obviously) to have duplicated names.
You should probably look at $File::Find::dir and $File::Find::name from File::Find's wanted() method to distinguish between a non-uniquely named files/directories by location.

Update 2: Use a hash.


If the information in this post is inaccurate, or just plain wrong, don't just downvote - please post explaining what's wrong.
That way everyone learns.

Replies are listed 'Best First'.
Re: Re: Duplicate Directory Names
by salvadors (Pilgrim) on Oct 18, 2003 at 14:08 UTC

    This can be handled neatly with File::Find::Rule as well, which is a nicer interface to File::Find:

    #!/usr/bin/perl -l use File::Find::Rule; print foreach File::Find::Rule ->directory ->exec(sub { $seen{$_}++ }) ->in(shift || ".");

    Tony