develooper Front page | perl.beginners | Postings from April 2010

Re: File::Find and top level directory

Thread Previous
From:
Shlomi Fish
Date:
April 25, 2010 02:35
Subject:
Re: File::Find and top level directory
Message ID:
201004251235.06744.shlomif@iglu.org.il
On Saturday 24 Apr 2010 22:00:56 Harry Putnam wrote:
> When using File::Find;
> Is there any built in way to know when you are in the top level of one
> of the directories in @directories?
> 
> I mean besides grepping $File::Find::dir.
> 
> I know that give the current directory name and of course the top
> directory could be massages out with something like:
> 
>    my ($tdir) = $File::Find::dir =~  m/^\.\/([^\/]+)/;
> 
> I didn't notice anything in perldoc File::Find, that seemed relevant
> so I'm guessing there is not any better way to know what is the top
> level of currently recursed directory.

There isn't one as far as I know. Touting my own horn, I should note that 
there is an easy way to do it in File-Find-Object :

http://www.shlomifish.org/open-source/projects/File-Find-Object/

In http://search.cpan.org/perldoc?File::Find::Object::Result - see 
<< $result->full_components() >>.

Regards,

	Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Best Introductory Programming Language - http://shlom.in/intro-lang

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About