Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Duplicate Directory Names

by BazB (Priest)
on Oct 17, 2003 at 20:57 UTC ( [id://300158]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://300158]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-18 04:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found